Bug 17699: Add test descriptions
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 31 Jul 2017 14:30:00 +0000 (11:30 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 8 Aug 2017 12:22:10 +0000 (09:22 -0300)
Test plan:
  prove -v t/db_dependent/Koha/Patrons.t

 Subtest: renew_account
    1..30
    ok 1 - 2016-02-29T00:00:00 + 12 months must be 2017-02-28T00:00:00
    ok 2 - 2016-02-29T00:00:00 + 12 months must be 2017-02-28T00:00:00
    ok 3 - With BorrowerLogs, Koha::Patron->renew_account should have logged
    ok 4 - today + 12 months must be 2017-03-31T00:00:00
    ok 5 - today + 12 months must be 2017-03-31T00:00:00
    ok 6 - Without BorrowerLogs, Koha::Patron->renew_account should not have logged
    ok 7 - today + 12 months must be 2017-03-31T00:00:00
    ok 8 - today + 12 months must be 2017-03-31T00:00:00
    ok 9 - 2016-04-30T00:00:00 + 12 months must be 2017-04-30T00:00:00
    ok 10 - 2016-04-30T00:00:00 + 12 months must be 2017-04-30T00:00:00
    ok 11 - 2016-10-30T00:00:00 + 12 months must be 2017-10-30T00:00:00
    ok 12 - 2016-10-30T00:00:00 + 12 months must be 2017-10-30T00:00:00
    ok 13 - With BorrowerLogs, Koha::Patron->renew_account should have logged
    ok 14 - today + 12 months must be 2017-11-30T00:00:00
    ok 15 - today + 12 months must be 2017-11-30T00:00:00
    ok 16 - Without BorrowerLogs, Koha::Patron->renew_account should not have logged
    ok 17 - today + 12 months must be 2017-11-30T00:00:00
    ok 18 - today + 12 months must be 2017-11-30T00:00:00
    ok 19 - 2016-12-30T00:00:00 + 12 months must be 2017-12-30T00:00:00
    ok 20 - 2016-12-30T00:00:00 + 12 months must be 2017-12-30T00:00:00
    ok 21 - 2017-06-30T00:00:00 + 12 months must be 2018-06-30T00:00:00
    ok 22 - 2017-06-30T00:00:00 + 12 months must be 2018-06-30T00:00:00
    ok 23 - With BorrowerLogs, Koha::Patron->renew_account should have logged
    ok 24 - today + 12 months must be 2018-07-31T00:00:00
    ok 25 - today + 12 months must be 2018-07-31T00:00:00
    ok 26 - Without BorrowerLogs, Koha::Patron->renew_account should not have logged
    ok 27 - today + 12 months must be 2018-07-31T00:00:00
    ok 28 - today + 12 months must be 2018-07-31T00:00:00
    ok 29 - 2017-08-31T00:00:00 + 12 months must be 2018-08-31T00:00:00
    ok 30 - 2017-08-31T00:00:00 + 12 months must be 2018-08-31T00:00:00

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha/Patrons.t

index 19aca2b..cf06c4e 100644 (file)
@@ -292,31 +292,31 @@ subtest 'renew_account' => sub {
         t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'dateexpiry' );
         t::lib::Mocks::mock_preference( 'BorrowersLog',              1 );
         my $expiry_date = $retrieved_patron->renew_account;
-        is( $expiry_date, $a_year_later_minus_a_month, );
+        is( $expiry_date, $a_year_later_minus_a_month, "$a_month_ago + 12 months must be $a_year_later_minus_a_month" );
         my $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry;
-        is( dt_from_string($retrieved_expiry_date), $a_year_later_minus_a_month );
+        is( dt_from_string($retrieved_expiry_date), $a_year_later_minus_a_month, "$a_month_ago + 12 months must be $a_year_later_minus_a_month" );
         my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count;
         is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->renew_account should have logged' );
 
         t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' );
         t::lib::Mocks::mock_preference( 'BorrowersLog',              0 );
         $expiry_date = $retrieved_patron->renew_account;
-        is( $expiry_date, $a_year_later, );
+        is( $expiry_date, $a_year_later, "today + 12 months must be $a_year_later" );
         $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry;
-        is( dt_from_string($retrieved_expiry_date), $a_year_later );
+        is( dt_from_string($retrieved_expiry_date), $a_year_later, "today + 12 months must be $a_year_later" );
         $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count;
         is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->renew_account should not have logged' );
 
         t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' );
         $expiry_date = $retrieved_patron_2->renew_account;
-        is( $expiry_date, $a_year_later );
+        is( $expiry_date, $a_year_later, "today + 12 months must be $a_year_later" );
         $retrieved_expiry_date = Koha::Patrons->find( $patron_2->{borrowernumber} )->dateexpiry;
-        is( dt_from_string($retrieved_expiry_date), $a_year_later );
+        is( dt_from_string($retrieved_expiry_date), $a_year_later, "today + 12 months must be $a_year_later" );
 
         $expiry_date = $retrieved_patron_3->renew_account;
-        is( $expiry_date, $a_year_later_plus_a_month );
+        is( $expiry_date, $a_year_later_plus_a_month, "$a_month_later + 12 months must be $a_year_later_plus_a_month" );
         $retrieved_expiry_date = Koha::Patrons->find( $patron_3->{borrowernumber} )->dateexpiry;
-        is( dt_from_string($retrieved_expiry_date), $a_year_later_plus_a_month );
+        is( dt_from_string($retrieved_expiry_date), $a_year_later_plus_a_month, "$a_month_later + 12 months must be $a_year_later_plus_a_month" );
 
         $retrieved_patron->delete;
         $retrieved_patron_2->delete;