Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 21; |
22 |
use Test::More tests => 22; |
23 |
|
23 |
|
24 |
use Test::MockModule; |
24 |
use Test::MockModule; |
25 |
use Test::Exception; |
25 |
use Test::Exception; |
Lines 2254-2256
subtest 'filter_by_checked_out' => sub {
Link Here
|
2254 |
$schema->storage->txn_rollback; |
2254 |
$schema->storage->txn_rollback; |
2255 |
|
2255 |
|
2256 |
}; |
2256 |
}; |
2257 |
- |
2257 |
|
|
|
2258 |
subtest 'filter_by_in_transit' => sub { |
2259 |
plan tests => 3; |
2260 |
|
2261 |
$schema->storage->txn_begin; |
2262 |
|
2263 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2264 |
t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); |
2265 |
|
2266 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2267 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
2268 |
|
2269 |
my $biblio = $builder->build_sample_biblio(); |
2270 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, }); |
2271 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, }); |
2272 |
|
2273 |
is( $biblio->items->filter_by_in_transit->count, 0, "Filtered 0 in transit items" ); |
2274 |
|
2275 |
my $transfer_1 = $builder->build_object( |
2276 |
{ |
2277 |
class => 'Koha::Item::Transfers', |
2278 |
value => { |
2279 |
itemnumber => $item_1->itemnumber, |
2280 |
frombranch => $library_1->{branchcode}, |
2281 |
tobranch => $library_2->{branchcode}, |
2282 |
} |
2283 |
} |
2284 |
); |
2285 |
|
2286 |
is( $biblio->items->filter_by_in_transit->count, 1, "Filtered 1 in transit items" ); |
2287 |
|
2288 |
my $transfer_2 = $builder->build_object( |
2289 |
{ |
2290 |
class => 'Koha::Item::Transfers', |
2291 |
value => { |
2292 |
itemnumber => $item_2->itemnumber, |
2293 |
frombranch => $library_2->{branchcode}, |
2294 |
tobranch => $library_1->{branchcode}, |
2295 |
} |
2296 |
} |
2297 |
); |
2298 |
|
2299 |
is( $biblio->items->filter_by_in_transit->count, 2, "Filtered 2 in transit items" ); |
2300 |
|
2301 |
$schema->storage->txn_rollback; |
2302 |
|
2303 |
}; |