Lines 19-29
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
23 |
|
23 |
|
24 |
use Koha::Issue; |
24 |
use Koha::Issue; |
25 |
use Koha::Issues; |
25 |
use Koha::Issues; |
26 |
use Koha::Database; |
26 |
use Koha::Database; |
|
|
27 |
use Koha::DateUtils; |
27 |
|
28 |
|
28 |
use t::lib::TestBuilder; |
29 |
use t::lib::TestBuilder; |
29 |
|
30 |
|
Lines 52-57
is( Koha::Issues->search->count, $nb_of_issues + 2, 'The 2 issues should have be
Link Here
|
52 |
my $retrieved_issue_1 = Koha::Issues->find( $new_issue_1->issue_id ); |
53 |
my $retrieved_issue_1 = Koha::Issues->find( $new_issue_1->issue_id ); |
53 |
is( $retrieved_issue_1->itemnumber, $new_issue_1->itemnumber, 'Find a issue by id should return the correct issue' ); |
54 |
is( $retrieved_issue_1->itemnumber, $new_issue_1->itemnumber, 'Find a issue by id should return the correct issue' ); |
54 |
|
55 |
|
|
|
56 |
subtest 'is_overdue' => sub { |
57 |
plan tests => 6; |
58 |
my $ten_days_ago = dt_from_string->add( days => -10 ); |
59 |
my $ten_days_later = dt_from_string->add( days => 10 ); |
60 |
my $yesterday = dt_from_string->add( days => -1 ); |
61 |
my $tomorrow = dt_from_string->add( days => 1 ); |
62 |
|
63 |
$retrieved_issue_1->date_due($ten_days_ago)->store; |
64 |
is( $retrieved_issue_1->is_overdue, |
65 |
1, 'The item should have been returned 10 days ago' ); |
66 |
|
67 |
$retrieved_issue_1->date_due($ten_days_later)->store; |
68 |
is( $retrieved_issue_1->is_overdue, 0, 'The item is due in 10 days' ); |
69 |
|
70 |
$retrieved_issue_1->date_due($tomorrow)->store; |
71 |
is( $retrieved_issue_1->is_overdue($ten_days_later), |
72 |
1, 'The item should have been returned yesterday' ); |
73 |
|
74 |
$retrieved_issue_1->date_due($yesterday)->store; |
75 |
is( $retrieved_issue_1->is_overdue($ten_days_ago), |
76 |
0, 'Ten days ago the item due yesterday was not late' ); |
77 |
|
78 |
$retrieved_issue_1->date_due($tomorrow)->store; |
79 |
is( $retrieved_issue_1->is_overdue($ten_days_later), |
80 |
1, 'In Ten days, the item due tomorrow will be late' ); |
81 |
|
82 |
$retrieved_issue_1->date_due($yesterday)->store; |
83 |
is( $retrieved_issue_1->is_overdue($ten_days_ago), |
84 |
0, 'In Ten days, the item due yesterday will still be late' ); |
85 |
}; |
86 |
|
55 |
$retrieved_issue_1->delete; |
87 |
$retrieved_issue_1->delete; |
56 |
is( Koha::Issues->search->count, $nb_of_issues + 1, 'Delete should delete the issue' ); |
88 |
is( Koha::Issues->search->count, $nb_of_issues + 1, 'Delete should delete the issue' ); |
57 |
|
89 |
|
58 |
- |
|
|