Bugzilla – Attachment 105643 Details for
Bug 25552
Add missing Claims Returned option to MarkLostItemsAsReturned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25552: Unit tests
Bug-25552-Unit-tests.patch (text/plain), 3.49 KB, created by
Kyle M Hall (khall)
on 2020-06-08 13:17:00 UTC
(
hide
)
Description:
Bug 25552: Unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-06-08 13:17:00 UTC
Size:
3.49 KB
patch
obsolete
>From f8f090094c2cd2b1c84f38defc923ee347b36af0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 8 Jun 2020 09:16:00 -0400 >Subject: [PATCH] Bug 25552: Unit tests > >--- > t/db_dependent/Circulation/ReturnClaims.t | 50 +++++++++++++++++++++-- > 1 file changed, 47 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Circulation/ReturnClaims.t b/t/db_dependent/Circulation/ReturnClaims.t >index 464420ead2..fe9928bafa 100644 >--- a/t/db_dependent/Circulation/ReturnClaims.t >+++ b/t/db_dependent/Circulation/ReturnClaims.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::MockModule; > use Test::Warn; > >@@ -58,10 +58,11 @@ Koha::CirculationRules->set_rule( > > $branch = $builder->build( { source => 'Branch' } )->{branchcode}; > >-subtest 'Test Koha::Checkout::claim_returned' => sub { >- plan tests => 6; >+subtest 'Test Koha::Checkout::claim_returned, do not mark as returned' => sub { >+ plan tests => 7; > > t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); >+ t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{} ); > my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); > my $item = $builder->build_object( > { >@@ -90,6 +91,9 @@ subtest 'Test Koha::Checkout::claim_returned' => sub { > is( $claim->notes, "Test note", "Claim notes match" ); > is( $claim->created_by, $patron->id, "Claim created_by matches" ); > ok( $claim->created_on, "Claim created_on is set" ); >+ >+ my $checkout2 = Koha::Checkouts->find( $checkout->id ); >+ is( $checkout2->id, $checkout->id, "Item is still checked out to patron") > }; > > subtest 'Test Koha::Patronn::return_claims' => sub { >@@ -132,4 +136,44 @@ subtest 'Test Koha::Patronn::return_claims' => sub { > ok( $claim->created_on, "Claim created_on is set" ); > }; > >+subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { >+ plan tests => 8; >+ >+ t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); >+ t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{claim_returned} ); >+ my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); >+ my $item = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ } >+ } >+ ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $checkout = AddIssue( $patron->unblessed, $item->barcode ); >+ >+ my $claim = $checkout->claim_returned( >+ { >+ created_by => $patron->id, >+ notes => "Test note", >+ } >+ ); >+ >+ is( $claim->issue_id, $checkout->id, "Claim issue id matches" ); >+ is( $claim->itemnumber, $item->id, "Claim itemnumber matches" ); >+ is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" ); >+ is( $claim->notes, "Test note", "Claim notes match" ); >+ is( $claim->created_by, $patron->id, "Claim created_by matches" ); >+ ok( $claim->created_on, "Claim created_on is set" ); >+ >+ my $checkout2 = Koha::Checkouts->find( $checkout->id ); >+ is( $checkout2, undef, "Checkout is not longer in the issues table"); >+ $checkout2 = Koha::Old::Checkouts->find( $checkout->id ); >+ is( $checkout2->id, $checkout->id, "Checkout was foudn in the old_issues table"); >+}; >+ > $schema->storage->txn_rollback; >-- >2.24.1 (Apple Git-126)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25552
:
105146
|
105389
|
105558
|
105559
|
105643
|
113889
|
113892
|
113893
|
113898
|
115685
|
115686
|
115687
|
115688
|
115689
|
116173