From 4b4ddc5d25fdbbe8e25b084ae1fa88955ffb59b5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 9 May 2024 08:40:18 +0100 Subject: [PATCH] Bug 36687: (RM follow-up) Fix unit tests Set notforloan to '0' as apposed to 'undef' for tests Signed-off-by: Martin Renvoize --- t/db_dependent/Circulation.t | 22 +++++++++++----------- t/db_dependent/Circulation/issue.t | 10 ++++++---- t/db_dependent/CourseReserves.t | 3 +-- t/db_dependent/Holds/LocalHoldsPriority.t | 5 +++-- t/db_dependent/Holds/RevertWaitingStatus.t | 3 +-- t/db_dependent/Koha/Items.t | 8 ++++---- t/db_dependent/Labels/t_Label.t | 2 +- t/db_dependent/Reserves.t | 3 +-- t/db_dependent/api/v1/items.t | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 8cabe0f09d4..24d5909d82c 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -143,11 +143,11 @@ my $itemtype = $builder->build( { source => 'Itemtype', value => { - notforloan => undef, - rentalcharge => 0, + notforloan => 0, + rentalcharge => 0, rentalcharge_daily => 0, - defaultreplacecost => undef, - processfee => undef + defaultreplacecost => undef, + processfee => undef } } )->{itemtype}; @@ -4650,7 +4650,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { my $itemtype = $builder->build( { source => 'Itemtype', - value => { notforloan => undef, } + value => { notforloan => 0, } } ); my $item = $builder->build_sample_item( @@ -4684,7 +4684,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { ); # not for loan at item level - Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; + Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(0)->store; $item->notforloan( 1 )->store; ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); @@ -4704,7 +4704,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { my $itemtype = $builder->build( { source => 'Itemtype', - value => { notforloan => undef, } + value => { notforloan => 0, } } ); @@ -4726,7 +4726,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { ); # not for loan at item level - Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(undef)->store; + Koha::ItemTypes->find( $itemtype->{itemtype} )->notforloan(0)->store; $item->notforloan( 1 )->store; ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, undef ); is_deeply( $needsconfirmation, {}, 'No confirmation needed, AllowNotForLoanOverride=0' ); @@ -5191,7 +5191,7 @@ subtest 'Incremented fee tests' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => undef, + notforloan => 0, rentalcharge => 0, rentalcharge_daily => 1, rentalcharge_daily_calendar => 0 @@ -5456,8 +5456,8 @@ subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => 0, - rentalcharge => 0, + notforloan => 0, + rentalcharge => 0, rentalcharge_daily => 0 } } diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t index 86720d8edfb..8b91a27a880 100755 --- a/t/db_dependent/Circulation/issue.t +++ b/t/db_dependent/Circulation/issue.t @@ -73,13 +73,15 @@ $dbh->do(q|DELETE FROM statistics|); # Generate sample datas my $itemtype = $builder->build( - { source => 'Itemtype', - value => { notforloan => undef, rentalcharge => 0 } + { + source => 'Itemtype', + value => { notforloan => 0, rentalcharge => 0 } } )->{itemtype}; my $itemtype2 = $builder->build( - { source => 'Itemtype', - value => { notforloan => undef } + { + source => 'Itemtype', + value => { notforloan => 0 } } )->{itemtype}; my $branchcode_1 = $builder->build({ source => 'Branch' })->{branchcode}; diff --git a/t/db_dependent/CourseReserves.t b/t/db_dependent/CourseReserves.t index f8715c209dd..06af1b5a503 100755 --- a/t/db_dependent/CourseReserves.t +++ b/t/db_dependent/CourseReserves.t @@ -35,8 +35,7 @@ $schema->storage->txn_begin; my $builder = t::lib::TestBuilder->new; my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; -my $itemtype = $builder->build( - { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype}; +my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => 0 } } )->{itemtype}; # Create 10 sample borrowers my @borrowers = (); diff --git a/t/db_dependent/Holds/LocalHoldsPriority.t b/t/db_dependent/Holds/LocalHoldsPriority.t index 85833ca8d50..95af26981f2 100755 --- a/t/db_dependent/Holds/LocalHoldsPriority.t +++ b/t/db_dependent/Holds/LocalHoldsPriority.t @@ -32,8 +32,9 @@ my $library2 = $builder->build({ source => 'Branch', }); my $library3 = $builder->build({ source => 'Branch', }); my $library4 = $builder->build({ source => 'Branch', }); my $itemtype = $builder->build( - { source => 'Itemtype', - value => { notforloan => undef, rentalcharge => 0 } + { + source => 'Itemtype', + value => { notforloan => 0, rentalcharge => 0 } } )->{itemtype}; diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index 75b1290d345..069c7537c16 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -38,8 +38,7 @@ $dbh->do("DELETE FROM reserves"); $dbh->do("DELETE FROM old_reserves"); my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; -my $itemtype = $builder->build( - { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype}; +my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => 0 } } )->{itemtype}; t::lib::Mocks::mock_userenv({ flags => 1, userid => '1', branchcode => $branchcode }); diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index 5b78910311e..ddf47a871aa 100755 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -268,7 +268,7 @@ subtest 'store' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => undef, + notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, processfee => $processfee_amount, @@ -791,7 +791,7 @@ subtest 'store' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => undef, + notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, processfee => 0, @@ -915,7 +915,7 @@ subtest 'store' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => undef, + notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, processfee => 0, @@ -1290,7 +1290,7 @@ subtest 'store' => sub { { class => 'Koha::ItemTypes', value => { - notforloan => undef, + notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, processfee => 0, diff --git a/t/db_dependent/Labels/t_Label.t b/t/db_dependent/Labels/t_Label.t index 32bde702665..524baf37797 100755 --- a/t/db_dependent/Labels/t_Label.t +++ b/t/db_dependent/Labels/t_Label.t @@ -54,7 +54,7 @@ my $branch_1 = $builder->build( { source => 'Branch' } )->{branchcode}; my $category_1 = $builder->build( { source => 'Category' } )->{categorycode}; # Add an item type -my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype}; +my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => 0 } } )->{itemtype}; t::lib::Mocks::mock_userenv( { branchcode => $branch_1 } ); diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 83b84bbc2d0..14fb88d5cbf 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -79,8 +79,7 @@ my $branch_3 = $builder->build({ source => 'Branch' })->{ branchcode }; my $category_1 = $builder->build({ source => 'Category' })->{ categorycode }; my $category_2 = $builder->build({ source => 'Category' })->{ categorycode }; # Add an item type -my $itemtype = $builder->build( - { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype}; +my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => 0 } } )->{itemtype}; t::lib::Mocks::mock_userenv({ branchcode => $branch_1 }); diff --git a/t/db_dependent/api/v1/items.t b/t/db_dependent/api/v1/items.t index 6b72b22ccb8..63ca5f73dbd 100755 --- a/t/db_dependent/api/v1/items.t +++ b/t/db_dependent/api/v1/items.t @@ -333,7 +333,7 @@ subtest 'get() tests' => sub { ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' ) ->json_is( '/effective_not_for_loan_status' => 2, 'effective_not_for_loan_status now picks up itemtype level - item-level_itypes:1' ); - $itype->notforloan(undef)->store(); + $itype->notforloan(0)->store(); $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'SWAGGER3.2.2' ) ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' )->json_is( '/effective_not_for_loan_status' => 0, -- 2.45.0