Bugzilla – Attachment 170604 Details for
Bug 37636
Checkout slip prints out of order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37636: Unit test
Bug-37636-Unit-test.patch (text/plain), 3.73 KB, created by
Nick Clemens (kidclamp)
on 2024-08-22 12:31:13 UTC
(
hide
)
Description:
Bug 37636: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-08-22 12:31:13 UTC
Size:
3.73 KB
patch
obsolete
>From 3bdd737166ba5edb9910705bb37176d3e598d55d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 22 Aug 2024 12:06:13 +0000 >Subject: [PATCH] Bug 37636: Unit test > >--- > t/db_dependent/Koha/Patrons.t | 40 +++++++++++++++++++++++++++-------- > 1 file changed, 31 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 954b220a39f..d3adc77dd78 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -617,7 +617,7 @@ subtest 'add_enrolment_fee_if_needed' => sub { > }; > > subtest 'checkouts + pending_checkouts + overdues + old_checkouts' => sub { >- plan tests => 17; >+ plan tests => 19; > > my $library = $builder->build( { source => 'Branch' } ); > my $biblionumber_1 = $builder->build_sample_biblio->biblionumber; >@@ -660,19 +660,41 @@ subtest 'checkouts + pending_checkouts + overdues + old_checkouts' => sub { > > t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); > >- AddIssue( $patron, $item_1->barcode, DateTime->now->subtract( days => 1 ) ); >- AddIssue( $patron, $item_2->barcode, DateTime->now->subtract( days => 5 ) ); >- AddIssue( $patron, $item_3->barcode ); >+ my $issue_1 = AddIssue( >+ $patron, $item_1->barcode, dt_from_string()->subtract( days => 1 ), undef, >+ dt_from_string()->subtract( days => 10 ) >+ ); >+ sleep(1); # Pause to ensure timestamps differ and that they do not affect ordering >+ AddIssue( >+ $patron, $item_2->barcode, dt_from_string()->subtract( days => 5 ), undef, >+ dt_from_string()->subtract( days => 1 ) >+ ); >+ sleep(1); >+ AddIssue( $patron, $item_3->barcode, undef, undef, dt_from_string()->subtract( days => 5 ) ); >+ sleep(1); > > $checkouts = $patron->checkouts; >- is( $checkouts->count, 3, 'checkouts should return 3 issues for that patron' ); >- is( ref($checkouts), 'Koha::Checkouts', 'checkouts should return a Koha::Checkouts object' ); >+ is( $checkouts->count, 3, 'checkouts should return 3 issues for that patron' ); >+ is( ref($checkouts), 'Koha::Checkouts', 'checkouts should return a Koha::Checkouts object' ); > $pending_checkouts = $patron->pending_checkouts; >- is( $pending_checkouts->count, 3, 'pending_checkouts should return 3 issues for that patron' ); >- is( ref($pending_checkouts), 'Koha::Checkouts', 'pending_checkouts should return a Koha::Checkouts object' ); >+ is( $pending_checkouts->count, 3, 'pending_checkouts should return 3 issues for that patron' ); >+ is( ref($pending_checkouts), 'Koha::Checkouts', 'pending_checkouts should return a Koha::Checkouts object' ); >+ >+ my @itemnumbers = $pending_checkouts->get_column('itemnumber'); >+ is_deeply( >+ \@itemnumbers, [ $item_2->itemnumber, $item_3->itemnumber, $item_1->itemnumber ], >+ "Checkouts are ordered by the date issued" >+ ); >+ $issue_1->auto_renew_error("Updated")->store; >+ $pending_checkouts = $patron->pending_checkouts; >+ @itemnumbers = $pending_checkouts->get_column('itemnumber'); >+ is_deeply( >+ \@itemnumbers, [ $item_2->itemnumber, $item_3->itemnumber, $item_1->itemnumber ], >+ "Checkouts are still ordered by the date issued, updates do not reorder" >+ ); > > my $first_checkout = $pending_checkouts->next; >- is( $first_checkout->unblessed_all_relateds->{biblionumber}, $item_3->biblionumber, 'pending_checkouts should prefetch values from other tables (here biblio)' ); >+ is( $first_checkout->unblessed_all_relateds->{biblionumber}, $item_2->biblionumber, 'pending_checkouts should prefetch values from other tables (here biblio)' ); > > my $overdues = $patron->overdues; > is( $overdues->count, 2, 'Patron should have 2 overdues'); >-- >2.39.2
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 37636
:
170496
|
170556
|
170558
|
170604
|
170605
|
171453
|
171454