|
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 2090-2093
subtest "GetItemsAvailableToFillHoldsRequestsForBib" => sub {
Link Here
|
| 2090 |
is( scalar @$items, 2, "Two items without active transfers correctly retrieved"); |
2090 |
is( scalar @$items, 2, "Two items without active transfers correctly retrieved"); |
| 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 |
$schema->storage->txn_rollback; |
| 2094 |
}; |
| 2095 |
|
| 2096 |
subtest 'Remove item from holds queue on checkout' => sub { |
| 2097 |
|
| 2098 |
plan tests => 2; |
| 2099 |
|
| 2100 |
$schema->storage->txn_begin; |
| 2101 |
|
| 2102 |
my $lib = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 2103 |
|
| 2104 |
my $patron1 = $builder->build_object( |
| 2105 |
{ |
| 2106 |
class => 'Koha::Patrons', |
| 2107 |
value => { branchcode => $lib->branchcode } |
| 2108 |
} |
| 2109 |
); |
| 2110 |
my $patron2 = $builder->build_object( |
| 2111 |
{ |
| 2112 |
class => 'Koha::Patrons', |
| 2113 |
value => { branchcode => $lib->branchcode } |
| 2114 |
} |
| 2115 |
); |
| 2116 |
|
| 2117 |
my $item = $builder->build_sample_item( |
| 2118 |
{ homebranch => $lib->branchcode, holdingbranch => $lib->branchcode } ); |
| 2119 |
|
| 2120 |
t::lib::Mocks::mock_userenv( { branchcode => $lib->branchcode } ); |
| 2121 |
|
| 2122 |
my $hold_id = AddReserve( |
| 2123 |
{ |
| 2124 |
branchcode => $item->homebranch, |
| 2125 |
borrowernumber => $patron2->borrowernumber, |
| 2126 |
biblionumber => $item->biblionumber, |
| 2127 |
itemnumber => undef, |
| 2128 |
priority => 1 |
| 2129 |
} |
| 2130 |
); |
| 2131 |
|
| 2132 |
C4::HoldsQueue::CreateQueue(); |
| 2133 |
|
| 2134 |
is( Koha::Hold::HoldsQueueItems->search({ itemnumber => $item->id })->count(), 1, "Item is found in the holds queue" ); |
| 2135 |
|
| 2136 |
AddIssue( $patron1, $item->barcode, dt_from_string ); |
| 2137 |
|
| 2138 |
is( Koha::Hold::HoldsQueueItems->search({ itemnumber => $item->id })->count(), 0, "Item is no longer found in the holds queue" ); |
| 2139 |
|
| 2140 |
$schema->storage->txn_rollback; |
| 2093 |
}; |
2141 |
}; |
| 2094 |
- |
|
|