From 1818e1785be6b7db06df5419575de5262ac525c3 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 20 Nov 2020 13:35:15 +0200 Subject: [PATCH] Bug 12388: Adjust tests some more We should now test if issues are really sorted with date_due. This patch adjusts test for daily loans so that test issues have different date_due values. Also removes some now unneeded code from IssueSlip.t. To test prove t/db_dependent/Members/IssueSlip.t Sponsored-by: Koha-Suomi Oy --- t/db_dependent/Members/IssueSlip.t | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t index ae175f92c2..3552b62f6a 100755 --- a/t/db_dependent/Members/IssueSlip.t +++ b/t/db_dependent/Members/IssueSlip.t @@ -125,6 +125,7 @@ $module->mock( 'userenv', sub { { branch => $branchcode } } ); my $today = dt_from_string; my $yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); +my $tomorrow = dt_from_string->add( DateTime::Duration->new( days => 1 ) ); subtest 'Issue slip' => sub { plan tests => 3; @@ -153,20 +154,16 @@ EOS my $today_daily_as_formatted = output_pref( $today_daily ); my $yesterday_daily = $yesterday->clone->set( hour => 23, minute => 59 ); my $yesterday_daily_as_formatted = output_pref( $yesterday_daily ); + my $tomorrow_daily_as_formatted = output_pref( $tomorrow ); my ( $date_due, $issue_date, $slip, $expected_slip ); - $date_due = $today_daily; + $date_due = $tomorrow; $issue_date = $today_daily->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); AddIssue( $borrower, $barcode1, $date_due, undef, $issue_date ); $date_due = $today_daily; $issue_date = $yesterday_daily; AddIssue( $borrower, $barcode2, $date_due, undef, $issue_date ); - # Set timestamps to the same value to avoid a different order - Koha::Checkouts->search( - { borrowernumber => $borrower->{borrowernumber} } - )->update( { timestamp => dt_from_string } ); - $expected_slip = <clone; AddIssue( $borrower, $barcode2, $date_due_in_time, undef, $issue_date ); - # Set timestamps to the same value to avoid a different order - Koha::Checkouts->search( - { borrowernumber => $borrower->{borrowernumber} } - )->update( { timestamp => dt_from_string } ); - $expected_slip = <