Bugzilla – Attachment 154062 Details for
Bug 34117
Duplicate patron sets dateenrolled incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34117: Add unit tests
Bug-34117-Add-unit-tests.patch (text/plain), 2.81 KB, created by
Katrin Fischer
on 2023-07-29 19:41:35 UTC
(
hide
)
Description:
Bug 34117: Add unit tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-07-29 19:41:35 UTC
Size:
2.81 KB
patch
obsolete
>From 805068a39b61ce7a6d9a9f62192431bce854fa91 Mon Sep 17 00:00:00 2001 >From: emlam <emily.lamancusa@montgomerycountymd.gov> >Date: Thu, 27 Jul 2023 14:33:38 +0000 >Subject: [PATCH] Bug 34117: Add unit tests > >To test: >prove t/db_dependent/Koha/Patron/Categories.t > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/Patron/Categories.t | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index f6cdba7e24..6a7b8bcd6f 100755 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -62,7 +62,7 @@ is( $retrieved_category_1->checkprevcheckout, 'inherit', 'Koha::Patron::Category > is( $retrieved_category_2->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' ); > > subtest 'get_expiry_date' => sub { >- plan tests => 5; >+ plan tests => 7; > 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 ); >@@ -76,10 +76,26 @@ subtest 'get_expiry_date' => sub { > 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' ); > >+ my $dt = dt_from_string; >+ my $original_dt = $dt->clone; >+ $category->get_expiry_date($dt); >+ is( >+ t::lib::Dates::compare( $dt, $original_dt ), 0, >+ 'Without enrolment period, DateTime object passed as a parameter should not be modified when ->get_expiry_date is called' >+ ); >+ > $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' ); > >+ $dt = dt_from_string; >+ $original_dt = $dt->clone; >+ $category->get_expiry_date($dt); >+ is( >+ t::lib::Dates::compare( $dt, $original_dt ), 0, >+ 'With enrolment period defined, DateTime object passed as a parameter should not be modified when ->get_expiry_date is called' >+ ); >+ > 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' ); > >-- >2.30.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 34117
:
152656
|
152657
|
153977
|
153982
|
153991
|
153992
|
154061
| 154062