Bugzilla – Attachment 85952 Details for
Bug 22446
Koha/Patron/Categories.t is failing on March 1st (2019 only?) and Feb 29th 2024
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22446: Add tests to highlight the problem
Bug-22446-Add-tests-to-highlight-the-problem.patch (text/plain), 4.23 KB, created by
Jonathan Druart
on 2019-03-02 17:37:05 UTC
(
hide
)
Description:
Bug 22446: Add tests to highlight the problem
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-03-02 17:37:05 UTC
Size:
4.23 KB
patch
obsolete
>From 2ca2b7db04ab7fb88f9d54c6373a142e4f74bd89 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 2 Mar 2019 14:36:40 -0300 >Subject: [PATCH] Bug 22446: Add tests to highlight the problem > >--- > t/db_dependent/Koha/Patron/Categories.t | 51 +++++++++++++++++++-------------- > 1 file changed, 30 insertions(+), 21 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index 58882a493e..1e2ddb7d6d 100644 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -20,6 +20,7 @@ > use Modern::Perl; > > use Test::More tests => 10; >+use Time::Fake; > > use C4::Context; > use Koha::Database; >@@ -62,27 +63,35 @@ is( $retrieved_category_2->checkprevcheckout, 'inherit', 'Koha::Patron::Category > > subtest 'get_expiry_date' => sub { > plan tests => 5; >- my $next_month = dt_from_string->add( months => 1 ); >- my $next_year = dt_from_string->add( months => 12 ); >- my $yesterday = dt_from_string->add( days => -1 ); >- my $category = Koha::Patron::Category->new({ >- categorycode => 'mycat', >- category_type => 'A', >- description => 'mycatdesc', >- enrolmentperiod => undef, >- enrolmentperioddate => $next_month, >- })->store; >- is( $category->get_expiry_date, $next_month, 'Without enrolmentperiod and parameter, ->get_expiry_date should return enrolmentperioddate' ); >- is( $category->get_expiry_date( $next_year ), $next_month, 'Without enrolmentperiod, ->get_expiry_date should return enrolmentperiodadate even if a parameter is given' ); >- >- $category->enrolmentperiod( 12 )->store; >- is( t::lib::Dates::compare($category->get_expiry_date, $next_year), 0, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); >- is( t::lib::Dates::compare($category->get_expiry_date( $yesterday ), $next_year->clone->add( days => -1 )), 0, 'With enrolmentperiod defined and a date given in parameter, ->get_expiry_date should take this date + enrolmentperiod' ); >- >- my $hardcoded_date = '2000-01-31'; >- is( t::lib::Dates::compare($category->get_expiry_date( $hardcoded_date ), dt_from_string( $hardcoded_date )->add( months => 12 )), 0, 'get_expiry_date accepts strings as well' ); >- >- $category->delete; >+ for my $date ( '2016-03-31', '2016-11-30', '2019-01-31', '2019-03-01', dt_from_string() ) { >+ subtest "get_expiry_date with today=$date" => sub { >+ plan tests => 5; >+ my $dt = dt_from_string( $date, 'iso' ); >+ Time::Fake->offset( $dt->epoch ); >+ >+ my $next_month = dt_from_string->add( months => 1 ); >+ my $next_year = dt_from_string->add( months => 12 ); >+ my $yesterday = dt_from_string->add( days => -1 ); >+ my $category = Koha::Patron::Category->new({ >+ categorycode => 'mycat', >+ category_type => 'A', >+ description => 'mycatdesc', >+ enrolmentperiod => undef, >+ enrolmentperioddate => $next_month, >+ })->store; >+ is( $category->get_expiry_date, $next_month, 'Without enrolmentperiod and parameter, ->get_expiry_date should return enrolmentperioddate' ); >+ is( $category->get_expiry_date( $next_year ), $next_month, 'Without enrolmentperiod, ->get_expiry_date should return enrolmentperiodadate even if a parameter is given' ); >+ >+ $category->enrolmentperiod( 12 )->store; >+ is( t::lib::Dates::compare($category->get_expiry_date, $next_year), 0, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); >+ is( t::lib::Dates::compare($category->get_expiry_date( $yesterday ), $next_year->clone->add( days => -1 )), 0, 'With enrolmentperiod defined and a date given in parameter, ->get_expiry_date should take this date + enrolmentperiod' ); >+ >+ my $hardcoded_date = '2000-01-31'; >+ is( t::lib::Dates::compare($category->get_expiry_date( $hardcoded_date ), dt_from_string( $hardcoded_date )->add( months => 12 )), 0, 'get_expiry_date accepts strings as well' ); >+ >+ $category->delete; >+ }; >+ } > }; > > subtest 'BlockExpiredPatronOpacActions' => sub { >-- >2.11.0
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 22446
: 85952 |
86011