Bugzilla – Attachment 53338 Details for
Bug 16911
Koha::Patrons - Move ExtendMemberSubscriptionTo to ->renew_account
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16911: Koha::Patron::Categories - Add tests for ->get_expiry_date
Bug-16911-KohaPatronCategories---Add-tests-for--ge.patch (text/plain), 2.54 KB, created by
Jonathan Druart
on 2016-07-12 18:56:14 UTC
(
hide
)
Description:
Bug 16911: Koha::Patron::Categories - Add tests for ->get_expiry_date
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-07-12 18:56:14 UTC
Size:
2.54 KB
patch
obsolete
>From d05c515c19011afe4c35e13b8476deac3beedd72 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Jul 2016 00:14:56 +0100 >Subject: [PATCH] Bug 16911: Koha::Patron::Categories - Add tests for > ->get_expiry_date > >--- > t/db_dependent/Koha/Patron/Categories.t | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index 974b982..03bd96c 100644 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -19,9 +19,10 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > > use Koha::Database; >+use Koha::DateUtils; > use Koha::Patron::Category; > use Koha::Patron::Categories; > use t::lib::TestBuilder; >@@ -49,6 +50,27 @@ is( $retrieved_category_1->categorycode, $new_category_1->categorycode, 'Find a > is_deeply( $retrieved_category_1->branch_limitations, [ $branch->{branchcode} ], 'The branch limitation should have been stored and retrieved' ); > is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' ); > >+subtest 'get_expiry_date' => sub { >+ plan tests => 4; >+ 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( $category->get_expiry_date, $next_year, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); >+ is( $category->get_expiry_date( $yesterday ), $next_year->clone->add( days => -1 ), 'With enrolmentperiod defined and a date given in parameter, ->get_expiry_date should take this date + enrolmentperiod' ); >+ $category->delete; >+}; >+ > $retrieved_category_1->delete; > is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' ); > >-- >2.8.1
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 16911
:
53338
|
53339
|
53340
|
53341
|
53346
|
53514
|
53515
|
53516
|
53517
|
53518
|
53533
|
54752
|
54753
|
54754
|
54755
|
54756
|
54757
|
54789
|
54790
|
54791
|
54792
|
54793
|
54794
|
55191
|
55192
|
55193
|
55194
|
55195
|
55196
|
55197
|
55424
|
55447