|
Lines 20-26
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use utf8; |
21 |
use utf8; |
| 22 |
|
22 |
|
| 23 |
use Test::More tests => 31; |
23 |
use Test::More tests => 32; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
| 25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
| 26 |
|
26 |
|
|
Lines 2362-2364
subtest 'location_update_trigger() tests' => sub {
Link Here
|
| 2362 |
|
2362 |
|
| 2363 |
$schema->storage->txn_rollback; |
2363 |
$schema->storage->txn_rollback; |
| 2364 |
}; |
2364 |
}; |
| 2365 |
- |
2365 |
|
|
|
2366 |
subtest 'not_for_loan() tests' => sub { |
| 2367 |
|
| 2368 |
plan tests => 5; |
| 2369 |
|
| 2370 |
$schema->storage->txn_begin; |
| 2371 |
|
| 2372 |
my $biblio = $builder->build_sample_biblio; |
| 2373 |
my $biblio_itype = Koha::ItemTypes->find( $biblio->itemtype ); |
| 2374 |
$biblio_itype->notforloan(3)->store(); |
| 2375 |
|
| 2376 |
my $item_itype = $builder->build_object( { class => 'Koha::ItemTypes' } ); |
| 2377 |
$item_itype->notforloan(2)->store(); |
| 2378 |
|
| 2379 |
my $item = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $item_itype->itemtype } ); |
| 2380 |
$item->notforloan(1)->store(); |
| 2381 |
|
| 2382 |
isnt( $biblio->itemtype, $item_itype->itemtype, "Biblio level itemtype and item level itemtype does not match" ); |
| 2383 |
|
| 2384 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
| 2385 |
diag("item-level_itypes: 0"); |
| 2386 |
|
| 2387 |
is( $item->not_for_loan, $item->notforloan, '->not_for_loan returns item specific notforloan value when defined and non-zero'); |
| 2388 |
|
| 2389 |
$item->notforloan(0)->store(); |
| 2390 |
is( $item->not_for_loan, $biblio_itype->notforloan, '->not_for_loan returns biblio level itype notforloan value when item notforloan is 0'); |
| 2391 |
|
| 2392 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
| 2393 |
diag("item-level_itypes: 1"); |
| 2394 |
|
| 2395 |
$item->notforloan(1)->store(); |
| 2396 |
is( $item->not_for_loan, $item->notforloan, '->not_for_loan returns item specific notforloan value when defined and non-zero'); |
| 2397 |
|
| 2398 |
$item->notforloan(0)->store(); |
| 2399 |
is( $item->not_for_loan, $item_itype->notforloan, '->not_for_loan returns biblio level itype notforloan value when item notforloan is 0'); |
| 2400 |
|
| 2401 |
$schema->storage->txn_rollback; |
| 2402 |
}; |