From ff3d869da2f27aaeffc1b3ae1378e7f148940261 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 19 Nov 2024 16:09:43 +0000 Subject: [PATCH] Bug 38486: Fix unit tests --- t/db_dependent/SIP/Transaction.t | 44 ++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 56a810a7360..1294c16f4cd 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -858,10 +858,27 @@ subtest do_checkout_with_patron_blocked => sub { }; subtest do_checkout_with_noblock => sub { - plan tests => 3; + plan tests => 1; + + my $mockILS = Test::MockObject->new; + my $server = { ils => $mockILS }; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); - my $patron = $builder->build_object( + + my $institution = { + id => $library->id, + implementation => "ILS", + policy => { + checkin => "true", + renewal => "true", + checkout => "true", + timeout => 100, + retries => 5, + } + }; + my $ils = C4::SIP::ILS->new($institution); + + my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { @@ -871,7 +888,8 @@ subtest do_checkout_with_noblock => sub { } ); - t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode, flags => 1 } ); + t::lib::Mocks::mock_userenv( + { branchcode => $library->branchcode, flags => 1 } ); my $item = $builder->build_sample_item( { @@ -879,21 +897,15 @@ subtest do_checkout_with_noblock => sub { } ); - my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); - my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); - my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new(); - is( - $co_transaction->patron($sip_patron), - $sip_patron, "Patron assigned to transaction" - ); - is( - $co_transaction->item($sip_item), - $sip_item, "Item assigned to transaction" - ); + my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); + my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); - $co_transaction->do_checkout( undef, '19990102 030405' ); + my $circ = + $ils->checkout( $patron->cardnumber, $item->barcode, undef, undef, + $server->{account}, '19990102 030405' ); - is( $patron->checkouts->count, 1, 'No Block checkout was performed for debarred patron' ); + is( $patron->checkouts->count, + 1, 'No Block checkout was performed for debarred patron' ); }; subtest do_checkout_with_holds => sub { -- 2.39.5 (Apple Git-154)