Bug 11445: regression test for duplicate hold notifications
This patch implements a regression test for verifying that
duplicate hold notifications aren't sent if ModReserveAffect() is
called repeatedly (as might happen if a circ operator accidentally
checks in an item and confirms its hold more than once).
Note that the test depends on the fact that _koha_notify_reserve()
defaults to sending a HOLD_PRINT letter if the borrower has not
specified an email or SMS hold notification.
To test:
[1] Run prove -v t/db_dependent/Reserves.t
[2] The 'patron not notified a second time (bug 11445)' test
should fail.
[3] Apply the main patch and run prove -v t/db_dependent/Reserves.t
again. This time all tests should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
e8808dfd52
commit
2b6a20c509
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 18;
|
||||
use Test::More tests => 20;
|
||||
use MARC::Record;
|
||||
use DateTime::Duration;
|
||||
|
||||
|
|
@ -270,7 +270,15 @@ is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve with
|
|||
# End of tests for bug 9761 (ConfirmFutureHolds)
|
||||
|
||||
# test marking a hold as captured
|
||||
my $hold_notice_count = count_hold_print_messages();
|
||||
ModReserveAffect($itemnumber, $requesters{'CPL'}, 0);
|
||||
my $new_count = count_hold_print_messages();
|
||||
is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting');
|
||||
|
||||
# test that duplicate notices aren't generated
|
||||
ModReserveAffect($itemnumber, $requesters{'CPL'}, 0);
|
||||
$new_count = count_hold_print_messages();
|
||||
is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)');
|
||||
|
||||
# avoiding the not_same_branch error
|
||||
t::lib::Mocks::mock_preference('IndependentBranches', 0);
|
||||
|
|
@ -284,3 +292,10 @@ my $letter = ReserveSlip('CPL', $requesters{'CPL'}, $bibnum);
|
|||
ok(defined($letter), 'can successfully generate hold slip (bug 10949)');
|
||||
|
||||
$dbh->rollback;
|
||||
|
||||
sub count_hold_print_messages {
|
||||
my $message_count = $dbh->selectall_arrayref(q{
|
||||
SELECT COUNT(*) FROM message_queue WHERE letter_code = 'HOLD_PRINT'
|
||||
});
|
||||
return $message_count->[0]->[0];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue