|
Lines 8-14
Link Here
|
| 8 |
|
8 |
|
| 9 |
use Modern::Perl; |
9 |
use Modern::Perl; |
| 10 |
|
10 |
|
| 11 |
use Test::More tests => 61; |
11 |
use Test::More tests => 62; |
| 12 |
use Data::Dumper; |
12 |
use Data::Dumper; |
| 13 |
|
13 |
|
| 14 |
use C4::Calendar qw( new insert_single_holiday ); |
14 |
use C4::Calendar qw( new insert_single_holiday ); |
|
Lines 2091-2093
subtest "GetItemsAvailableToFillHoldsRequestsForBib" => sub {
Link Here
|
| 2091 |
is_deeply( [$items->[0]->{itemnumber},$items->[1]->{itemnumber}],[$item_2->itemnumber,$item_3->itemnumber],"Correct two items retrieved"); |
2091 |
is_deeply( [$items->[0]->{itemnumber},$items->[1]->{itemnumber}],[$item_2->itemnumber,$item_3->itemnumber],"Correct two items retrieved"); |
| 2092 |
|
2092 |
|
| 2093 |
}; |
2093 |
}; |
| 2094 |
- |
2094 |
|
|
|
2095 |
subtest "Canceled holds should be removed from the holds queue" => sub { |
| 2096 |
|
| 2097 |
plan tests => 2; |
| 2098 |
|
| 2099 |
$schema->storage->txn_begin; |
| 2100 |
|
| 2101 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 0 ); |
| 2102 |
t::lib::Mocks::mock_preference( 'UseTransportCostMatrix', 0 ); |
| 2103 |
|
| 2104 |
my $branch1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 2105 |
my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } ); |
| 2106 |
my $patron = $builder->build_object( |
| 2107 |
{ |
| 2108 |
class => "Koha::Patrons", |
| 2109 |
value => { |
| 2110 |
branchcode => $branch1->branchcode, |
| 2111 |
categorycode => $category->categorycode |
| 2112 |
} |
| 2113 |
} |
| 2114 |
); |
| 2115 |
|
| 2116 |
my $biblio = $builder->build_sample_biblio(); |
| 2117 |
my $item1 = $builder->build_sample_item( |
| 2118 |
{ |
| 2119 |
biblionumber => $biblio->biblionumber, |
| 2120 |
library => $branch1->branchcode, |
| 2121 |
} |
| 2122 |
); |
| 2123 |
|
| 2124 |
my $reserve_id = AddReserve( |
| 2125 |
{ |
| 2126 |
branchcode => $branch1->branchcode, |
| 2127 |
borrowernumber => $patron->borrowernumber, |
| 2128 |
biblionumber => $biblio->biblionumber, |
| 2129 |
priority => 1, |
| 2130 |
} |
| 2131 |
); |
| 2132 |
|
| 2133 |
C4::HoldsQueue::CreateQueue(); |
| 2134 |
my $rs = $schema->resultset('TmpHoldsqueue'); |
| 2135 |
|
| 2136 |
is( $rs->search( { biblionumber => $biblio->biblionumber } )->count, 1, "Found the hold in the holds queue" ); |
| 2137 |
|
| 2138 |
Koha::Holds->find($reserve_id)->cancel(); |
| 2139 |
|
| 2140 |
is( |
| 2141 |
$rs->search( { biblionumber => $biblio->biblionumber } )->count, 0, |
| 2142 |
"Hold is no longer found in the holds queue after cancellation" |
| 2143 |
); |
| 2144 |
|
| 2145 |
$schema->storage->txn_rollback; |
| 2146 |
}; |