Bugzilla – Attachment 100549 Details for
Bug 24800
Koha does incomplete checkin when no return date is provided
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24800: Add tests
Bug-24800-Add-tests.patch (text/plain), 3.23 KB, created by
Jonathan Druart
on 2020-03-11 12:12:07 UTC
(
hide
)
Description:
Bug 24800: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-11 12:12:07 UTC
Size:
3.23 KB
patch
obsolete
>From a28af02771aeeec20f977dfe36b42f006097ebf1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 11 Mar 2020 12:56:41 +0100 >Subject: [PATCH] Bug 24800: Add tests > >--- > t/db_dependent/SIP/Transaction.t | 56 +++++++++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index c6d2abd65f..a287f614ff 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 7; >+use Test::More tests => 8; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -14,9 +14,12 @@ use C4::SIP::ILS::Transaction::RenewAll; > use C4::SIP::ILS::Transaction::Checkout; > use C4::SIP::ILS::Transaction::FeePayment; > use C4::SIP::ILS::Transaction::Hold; >+use C4::SIP::ILS::Transaction::Checkout; >+use C4::SIP::ILS::Transaction::Checkin; > > use C4::Reserves; > use Koha::CirculationRules; >+use Koha::DateUtils qw( dt_from_string output_pref ); > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -269,4 +272,55 @@ subtest do_hold => sub { > is( $patron_2->holds->next->priority, 2, 'Hold placed from SIP should have a correct priority of 2'); > }; > >+subtest do_checkin => sub { >+ plan tests => 8; >+ >+ 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, flags => 1 } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ >+ # Checkout >+ 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 $checkout = $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 1, 'Checkout should have been done successfully'); >+ >+ # Checkin >+ my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new(); >+ is( $ci_transaction->patron($sip_patron), >+ $sip_patron, "Patron assigned to transaction" ); >+ is( $ci_transaction->item($sip_item), >+ $sip_item, "Item assigned to transaction" ); >+ >+ my $checkin = $ci_transaction->do_checkin($library->branchcode, C4::SIP::Sip::timestamp); >+ is( $patron->checkouts->count, 0, 'Checkin should have been done successfully'); >+ >+ # Test checkin without return date >+ $co_transaction->do_checkout; >+ is( $patron->checkouts->count, 1, 'Checkout should have been done successfully'); >+ $ci_transaction->do_checkin($library->branchcode, undef); >+ is( $patron->checkouts->count, 0, 'Checkin should have been done successfully'); >+}; >+ > $schema->storage->txn_rollback; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24800
:
100549
|
100550
|
102452
|
102455
|
102456
|
102613
|
102614
|
102615
|
102616
|
102690
|
102691
|
104348