From dda4bca35d479df1d4039a7b892fe9af4328bc79 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Fri, 22 Sep 2017 08:40:56 +0000 Subject: [PATCH] Bug 19116: (followup) Add tests to highlight the problem in CheckReserves Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart (cherry picked from commit a0c73b7bdafd21e19e0c1ba6a7ea222216d70500) Signed-off-by: Fridolin Somers (cherry picked from commit b3cd8c2def10285e2efb85bf88a47f315d80a8a5) Signed-off-by: Katrin Fischer --- t/db_dependent/Circulation.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 5b3eef3c25..34d7f10697 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -1254,7 +1254,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { }; subtest 'Set waiting flag' => sub { - plan tests => 2; + plan tests => 4; my $library_1 = $builder->build( { source => 'Branch' } ); my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode} } } ); @@ -1292,12 +1292,17 @@ subtest 'Set waiting flag' => sub { my $hold = Koha::Holds->find( $reserve_id ); is( $hold->found, 'T', 'Hold is in transit' ); + my ( $status ) = CheckReserves($item->{itemnumber}); + is( $status, 'Reserved', 'Hold is not waiting yet'); + set_userenv( $library_2 ); $do_transfer = 0; AddReturn( $item->{barcode}, $library_2->{branchcode} ); ModReserveAffect( $item->{itemnumber}, undef, $do_transfer, $reserve_id ); $hold = Koha::Holds->find( $reserve_id ); is( $hold->found, 'W', 'Hold is waiting' ); + ( $status ) = CheckReserves($item->{itemnumber}); + is( $status, 'Waiting', 'Now the hold is waiting'); }; sub set_userenv { -- 2.39.5