From 5d0b4b4433b1751e16a1ed14b427ae266e4e72a6 Mon Sep 17 00:00:00 2001 From: Andreas Roussos Date: Thu, 13 Jul 2023 16:02:02 +0000 Subject: [PATCH] Bug 34258: update SIP-related unit test Test plan: 1) Run the updated SIP-related unit test *without* having applied the other patch from this bug report -- it should fail: $ prove t/db_dependent/SIP/ILS.t 2) Apply the patch that fixes C4/SIP/ILS/Transaction/Renew.pm 3) Re-run the unit test -- it should pass. Signed-off-by: Emily Lamancusa Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/SIP/ILS.t | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/SIP/ILS.t b/t/db_dependent/SIP/ILS.t index e96dd4ce55..10f4d28f68 100755 --- a/t/db_dependent/SIP/ILS.t +++ b/t/db_dependent/SIP/ILS.t @@ -20,7 +20,7 @@ use Modern::Perl; -use Test::More tests => 14; +use Test::More tests => 15; use t::lib::TestBuilder; use t::lib::Mocks; @@ -315,4 +315,34 @@ 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 }); + + 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; -- 2.39.5