|
Lines 3-9
Link Here
|
| 3 |
# This test deals with GetFictiveIssueNumber (from C4::Serials) |
3 |
# This test deals with GetFictiveIssueNumber (from C4::Serials) |
| 4 |
|
4 |
|
| 5 |
use Modern::Perl; |
5 |
use Modern::Perl; |
| 6 |
use Test::More tests => 4; |
6 |
use Test::More tests => 5; |
| 7 |
|
7 |
|
| 8 |
use Koha::Database; |
8 |
use Koha::Database; |
| 9 |
use C4::Serials; |
9 |
use C4::Serials; |
|
Lines 179-184
subtest 'Tests for weekly frequencies' => sub {
Link Here
|
| 179 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-02-10'), 4, 'Feb 10 goes to 4' ); |
179 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-02-10'), 4, 'Feb 10 goes to 4' ); |
| 180 |
}; |
180 |
}; |
| 181 |
|
181 |
|
| 182 |
# TODO: subtest 'Tests for dayly frequencies' => sub { |
182 |
subtest 'Tests for dayly frequencies' => sub { |
|
|
183 |
plan tests => 4; |
| 184 |
|
| 185 |
# First add a few frequencies |
| 186 |
my $freq_1i_12d = AddSubscriptionFrequency({ |
| 187 |
description => "1 issue per 12 days", |
| 188 |
unit => 'day', |
| 189 |
issuesperunit => 1, |
| 190 |
unitsperissue => 12, |
| 191 |
}); |
| 192 |
my $freq_3i_1d = AddSubscriptionFrequency({ |
| 193 |
description => "3 issues per day", |
| 194 |
unit => 'day', |
| 195 |
issuesperunit => 3, |
| 196 |
unitsperissue => 1, |
| 197 |
}); |
| 198 |
|
| 199 |
# TEST CASE - 1 issue per 12 days |
| 200 |
my $subscription = { |
| 201 |
periodicity => $freq_1i_12d, |
| 202 |
firstacquidate => '1972-03-16', |
| 203 |
countissuesperunit => 1, |
| 204 |
}; |
| 205 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-03-27'), 1, 'Mar 27 still 1' ); |
| 206 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-03-28'), 2, 'Mar 28 goes to 2' ); |
| 207 |
|
| 208 |
# TEST CASE - 3 issue per day |
| 209 |
$subscription = { |
| 210 |
periodicity => $freq_3i_1d, |
| 211 |
firstacquidate => '1972-04-23', |
| 212 |
countissuesperunit => 1, |
| 213 |
}; |
| 214 |
$subscription->{countissuesperunit} = 3; |
| 215 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-05-01'), 27, 'May 1 still 27' ); |
| 216 |
$subscription->{countissuesperunit} = 1; |
| 217 |
is( C4::Serials::GetFictiveIssueNumber($subscription, '1972-05-02'), 28, 'May 2 goes to 28' ); |
| 218 |
}; |
| 183 |
|
219 |
|
| 184 |
$schema->storage->txn_rollback; |
220 |
$schema->storage->txn_rollback; |
| 185 |
- |
|
|