Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 61; |
20 |
use Test::More tests => 62; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 807-812
subtest 'reserves.item_level_hold' => sub {
Link Here
|
807 |
|
807 |
|
808 |
}; |
808 |
}; |
809 |
|
809 |
|
|
|
810 |
subtest 'MoveReserve additional test' => sub { |
811 |
|
812 |
plan tests => 4; |
813 |
|
814 |
# Create the items and patrons we need |
815 |
my $biblio = $builder->build_sample_biblio(); |
816 |
my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); |
817 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype }); |
818 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $itype->itemtype }); |
819 |
my $patron_1 = $builder->build_object({ class => "Koha::Patrons" }); |
820 |
my $patron_2 = $builder->build_object({ class => "Koha::Patrons" }); |
821 |
|
822 |
# Place a hold on the title for both patrons |
823 |
my $reserve_1 = AddReserve( $item_1->homebranch, $patron_1->borrowernumber, $biblio->biblionumber, undef, 1 ); |
824 |
my $reserve_2 = AddReserve( $item_2->homebranch, $patron_2->borrowernumber, $biblio->biblionumber, undef, 1 ); |
825 |
is($patron_1->holds->next()->reserve_id, $reserve_1, "The 1st patron has a hold"); |
826 |
is($patron_2->holds->next()->reserve_id, $reserve_2, "The 2nd patron has a hold"); |
827 |
|
828 |
# Fake the holds queue |
829 |
$dbh->do(q{INSERT INTO hold_fill_targets VALUES (?, ?, ?, ?, ?)},undef,($patron_1->borrowernumber,$biblio->biblionumber,$item_1->itemnumber,$item_1->homebranch,0)); |
830 |
|
831 |
# The 2nd hold should be filed even if the item is preselected for the first hold |
832 |
MoveReserve($item_1->itemnumber,$patron_2->borrowernumber); |
833 |
is($patron_2->holds->count, 0, "The 2nd patrons no longer has a hold"); |
834 |
is($patron_2->old_holds->next()->reserve_id, $reserve_2, "The 2nd patrons hold was filled and moved to old holds"); |
835 |
|
836 |
}; |
837 |
|
810 |
sub count_hold_print_messages { |
838 |
sub count_hold_print_messages { |
811 |
my $message_count = $dbh->selectall_arrayref(q{ |
839 |
my $message_count = $dbh->selectall_arrayref(q{ |
812 |
SELECT COUNT(*) |
840 |
SELECT COUNT(*) |
813 |
- |
|
|