View | Details | Raw Unified | Return to bug 20584
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patron/Categories.t (-4 / +4 lines)
Lines 26-31 use Koha::Database; Link Here
26
use Koha::DateUtils;
26
use Koha::DateUtils;
27
use Koha::Patron::Category;
27
use Koha::Patron::Category;
28
use Koha::Patron::Categories;
28
use Koha::Patron::Categories;
29
use t::lib::Dates;
29
use t::lib::TestBuilder;
30
use t::lib::TestBuilder;
30
use t::lib::Mocks;
31
use t::lib::Mocks;
31
32
Lines 75-85 subtest 'get_expiry_date' => sub { Link Here
75
    is( $category->get_expiry_date( $next_year ), $next_month, 'Without enrolmentperiod, ->get_expiry_date should return enrolmentperiodadate even if a parameter is given' );
76
    is( $category->get_expiry_date( $next_year ), $next_month, 'Without enrolmentperiod, ->get_expiry_date should return enrolmentperiodadate even if a parameter is given' );
76
77
77
    $category->enrolmentperiod( 12 )->store;
78
    $category->enrolmentperiod( 12 )->store;
78
    is( $category->get_expiry_date, $next_year, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' );
79
    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' );
79
    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' );
80
    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' );
80
81
81
    my $hardcoded_date = '2000-01-31';
82
    my $hardcoded_date = '2000-01-31';
82
    is( $category->get_expiry_date( $hardcoded_date ), dt_from_string( $hardcoded_date )->add( months => 12 ), 'get_expiry_date accepts strings as well'  );
83
    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'  );
83
84
84
    $category->delete;
85
    $category->delete;
85
};
86
};
86
- 

Return to bug 20584