|
Lines 2765-2767
subtest 'check_booking tests' => sub {
Link Here
|
| 2765 |
|
2765 |
|
| 2766 |
$schema->storage->txn_rollback; |
2766 |
$schema->storage->txn_rollback; |
| 2767 |
}; |
2767 |
}; |
| 2768 |
- |
2768 |
|
|
|
2769 |
subtest 'not_for_loan() tests' => sub { |
| 2770 |
|
| 2771 |
plan tests => 5; |
| 2772 |
|
| 2773 |
$schema->storage->txn_begin; |
| 2774 |
|
| 2775 |
my $biblio = $builder->build_sample_biblio; |
| 2776 |
my $biblio_itype = Koha::ItemTypes->find( $biblio->itemtype ); |
| 2777 |
$biblio_itype->notforloan(3)->store(); |
| 2778 |
|
| 2779 |
my $item_itype = $builder->build_object( { class => 'Koha::ItemTypes' } ); |
| 2780 |
$item_itype->notforloan(2)->store(); |
| 2781 |
|
| 2782 |
my $item = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $item_itype->itemtype } ); |
| 2783 |
$item->notforloan(1)->store(); |
| 2784 |
|
| 2785 |
isnt( $biblio->itemtype, $item_itype->itemtype, "Biblio level itemtype and item level itemtype does not match" ); |
| 2786 |
|
| 2787 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
| 2788 |
note("item-level_itypes: 0"); |
| 2789 |
|
| 2790 |
is( |
| 2791 |
$item->not_for_loan, $item->notforloan, |
| 2792 |
'->not_for_loan returns item specific notforloan value when defined and non-zero' |
| 2793 |
); |
| 2794 |
|
| 2795 |
$item->notforloan(0)->store(); |
| 2796 |
is( |
| 2797 |
$item->not_for_loan, $biblio_itype->notforloan, |
| 2798 |
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' |
| 2799 |
); |
| 2800 |
|
| 2801 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
| 2802 |
note("item-level_itypes: 1"); |
| 2803 |
|
| 2804 |
$item->notforloan(1)->store(); |
| 2805 |
is( |
| 2806 |
$item->not_for_loan, $item->notforloan, |
| 2807 |
'->not_for_loan returns item specific notforloan value when defined and non-zero' |
| 2808 |
); |
| 2809 |
|
| 2810 |
$item->notforloan(0)->store(); |
| 2811 |
is( |
| 2812 |
$item->not_for_loan, $item_itype->notforloan, |
| 2813 |
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' |
| 2814 |
); |
| 2815 |
|
| 2816 |
$schema->storage->txn_rollback; |
| 2817 |
}; |