Lines 51-57
is_deeply( $retrieved_category_1->branch_limitations, [ $branch->{branchcode} ],
Link Here
|
51 |
is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' ); |
51 |
is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' ); |
52 |
|
52 |
|
53 |
subtest 'get_expiry_date' => sub { |
53 |
subtest 'get_expiry_date' => sub { |
54 |
plan tests => 4; |
54 |
plan tests => 5; |
55 |
my $next_month = dt_from_string->add( months => 1 ); |
55 |
my $next_month = dt_from_string->add( months => 1 ); |
56 |
my $next_year = dt_from_string->add( months => 12 ); |
56 |
my $next_year = dt_from_string->add( months => 12 ); |
57 |
my $yesterday = dt_from_string->add( days => -1 ); |
57 |
my $yesterday = dt_from_string->add( days => -1 ); |
Lines 68-73
subtest 'get_expiry_date' => sub {
Link Here
|
68 |
$category->enrolmentperiod( 12 )->store; |
68 |
$category->enrolmentperiod( 12 )->store; |
69 |
is( $category->get_expiry_date, $next_year, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); |
69 |
is( $category->get_expiry_date, $next_year, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); |
70 |
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' ); |
70 |
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' ); |
|
|
71 |
|
72 |
my $hardcoded_date = '2000-01-31'; |
73 |
is( $category->get_expiry_date( $hardcoded_date ), dt_from_string( $hardcoded_date )->add( months => 12 ), 'get_expiry_date accepts strings as well' ); |
74 |
|
71 |
$category->delete; |
75 |
$category->delete; |
72 |
}; |
76 |
}; |
73 |
|
77 |
|
74 |
- |
|
|