Bug 34846: Fix SIP/ILS.t if DB has been upgraded

t/db_dependent/SIP/ILS.t .. 12/15
    #   Failed test 'Renewal succeeded'
    #   at t/db_dependent/SIP/ILS.t line 346.
    #          got: '0'
    #     expected: '1'
    # Looks like you failed 1 test of 2.
t/db_dependent/SIP/ILS.t .. 15/15
 #   Failed test 'renew'
 #   at t/db_dependent/SIP/ILS.t line 348.
 # Looks like you failed 1 test of 15.

Because renewalsallowed is 0 for upgraded DB, when it's 5 for new
install.

We need to set the value.

Test plan:
perl /kohadevbox/misc4dev/run_tests.pl --run-db-upgrade-only

prove t/db_dependent/SIP/ILS.t

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5f55775f40)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bb19ca1618)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>
This commit is contained in:
Jonathan Druart 2023-09-20 16:13:40 +02:00 committed by Jacob O'Mara
parent da3aef00f8
commit bd8272bebb

View file

@ -315,4 +315,46 @@ subtest renew_all => sub {
isnt( $transaction->{screen_msg}, 'Invalid patron password.', "Empty password succeeds" );
};
subtest renew => sub {
plan tests => 2;
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
my $patron = $builder->build_object(
{
class => 'Koha::Patrons',
value => {
branchcode => $library->branchcode,
}
}
);
t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } );
Koha::CirculationRules->set_rule(
{
categorycode => undef,
itemtype => undef,
branchcode => undef,
rule_name => 'renewalsallowed',
rule_value => '5',
}
);
my $item = $builder->build_sample_item(
{
library => $library->branchcode,
}
);
AddIssue( $patron->unblessed, $item->barcode, undef, 0 );
my $checkout = $item->checkout;
ok( defined($checkout), "Successfully checked out an item prior to renewal" );
my $ils = C4::SIP::ILS->new( { id => $library->branchcode } );
my $transaction = $ils->renew( $patron->cardnumber, "", $item->barcode );
is( $transaction->{renewal_ok}, 1, "Renewal succeeded" );
};
$schema->storage->txn_rollback;