Bug 17229: Add unit test for BlockExpiredPatronOpacActions check
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
85ae9bd021
commit
a369a9c8c1
1 changed files with 19 additions and 1 deletions
|
@ -43,7 +43,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;
|
||||
|
||||
|
@ -127,6 +132,19 @@ my $patron = Koha::Patrons->find( $borrowernumbers[0] );
|
|||
$holds = $patron->holds;
|
||||
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
|
||||
|
||||
my $expired_borrowernumber = Koha::Patron->new({
|
||||
firstname => 'Expired',
|
||||
surname => 'Patron',
|
||||
categorycode => $category->{categorycode},
|
||||
branchcode => $branch_1,
|
||||
dateexpiry => '2000-01-01',
|
||||
})->store->borrowernumber;
|
||||
|
||||
t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
|
||||
ok(
|
||||
CanItemBeReserved($expired_borrowernumber, $itemnumber)->{status} eq 'patronExpired',
|
||||
'Expired patron cannot reserve'
|
||||
);
|
||||
|
||||
$holds = $item->current_holds;
|
||||
$first_hold = $holds->next;
|
||||
|
|
Loading…
Reference in a new issue