|
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 => 34; |
23 |
use Test::More tests => 35; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
| 25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
| 26 |
|
26 |
|
|
Lines 2738-2740
subtest 'check_booking tests' => sub {
Link Here
|
| 2738 |
|
2738 |
|
| 2739 |
$schema->storage->txn_rollback; |
2739 |
$schema->storage->txn_rollback; |
| 2740 |
}; |
2740 |
}; |
| 2741 |
- |
2741 |
|
|
|
2742 |
subtest 'not_for_loan() tests' => sub { |
| 2743 |
|
| 2744 |
plan tests => 5; |
| 2745 |
|
| 2746 |
$schema->storage->txn_begin; |
| 2747 |
|
| 2748 |
my $biblio = $builder->build_sample_biblio; |
| 2749 |
my $biblio_itype = Koha::ItemTypes->find( $biblio->itemtype ); |
| 2750 |
$biblio_itype->notforloan(3)->store(); |
| 2751 |
|
| 2752 |
my $item_itype = $builder->build_object( { class => 'Koha::ItemTypes' } ); |
| 2753 |
$item_itype->notforloan(2)->store(); |
| 2754 |
|
| 2755 |
my $item = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $item_itype->itemtype } ); |
| 2756 |
$item->notforloan(1)->store(); |
| 2757 |
|
| 2758 |
isnt( $biblio->itemtype, $item_itype->itemtype, "Biblio level itemtype and item level itemtype does not match" ); |
| 2759 |
|
| 2760 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
| 2761 |
diag("item-level_itypes: 0"); |
| 2762 |
|
| 2763 |
is( |
| 2764 |
$item->not_for_loan, $item->notforloan, |
| 2765 |
'->not_for_loan returns item specific notforloan value when defined and non-zero' |
| 2766 |
); |
| 2767 |
|
| 2768 |
$item->notforloan(0)->store(); |
| 2769 |
is( |
| 2770 |
$item->not_for_loan, $biblio_itype->notforloan, |
| 2771 |
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' |
| 2772 |
); |
| 2773 |
|
| 2774 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
| 2775 |
diag("item-level_itypes: 1"); |
| 2776 |
|
| 2777 |
$item->notforloan(1)->store(); |
| 2778 |
is( |
| 2779 |
$item->not_for_loan, $item->notforloan, |
| 2780 |
'->not_for_loan returns item specific notforloan value when defined and non-zero' |
| 2781 |
); |
| 2782 |
|
| 2783 |
$item->notforloan(0)->store(); |
| 2784 |
is( |
| 2785 |
$item->not_for_loan, $item_itype->notforloan, |
| 2786 |
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' |
| 2787 |
); |
| 2788 |
|
| 2789 |
$schema->storage->txn_rollback; |
| 2790 |
}; |