From 603b3a2ac223f347f92fdee95d28a9dd75f59935 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 31 Aug 2016 15:52:08 +0200 Subject: [PATCH] Bug 17229: Add unit test for BlockExpiredPatronOpacActions check Signed-off-by: Brendan Gallagher --- t/db_dependent/Holds.t | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index e2066c7a88..25385938cb 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -7,7 +7,7 @@ use t::lib::TestBuilder; use C4::Context; -use Test::More tests => 57; +use Test::More tests => 58; use MARC::Record; use C4::Biblio; @@ -41,7 +41,12 @@ my $dbh = C4::Context->dbh; my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode }; my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode }; -my $category = $builder->build({ source => 'Category' }); +my $category = $builder->build({ + source => 'Category', + value => { + BlockExpiredPatronOpacActions => -1, + }, +}); my $borrowers_count = 5; @@ -129,6 +134,16 @@ my $patron = Koha::Patrons->find( $borrowernumbers[0] ); $holds = $patron->holds; is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds"); +my $expired_borrowernumber = AddMember( + firstname => 'Expired', + surname => 'Patron', + categorycode => $category->{categorycode}, + branchcode => $branch_1, + dateexpiry => '2000-01-01', +); +t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); +is(CanItemBeReserved($expired_borrowernumber, $itemnumber), + 'expired', 'Expired patron cannot reserve'); $holds = $item->current_holds; $first_hold = $holds->next; @@ -656,3 +671,4 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub { $schema->storage->txn_rollback; }; + -- 2.13.7