Bug 36687: (RM follow-up) Fix unit tests

Set notforloan to '0' as apposed to 'undef' for tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2024-05-09 08:40:18 +01:00
parent 07d52309c2
commit fba56f0178
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
9 changed files with 29 additions and 29 deletions

View File

@ -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
}
}

View File

@ -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};

View File

@ -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 = ();

View File

@ -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};

View File

@ -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 });

View File

@ -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,

View File

@ -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 } );

View File

@ -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 });

View File

@ -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,