|
Lines 16-22
use C4::Biblio;
Link Here
|
| 16 |
use C4::Budgets; |
16 |
use C4::Budgets; |
| 17 |
use Koha::DateUtils; |
17 |
use Koha::DateUtils; |
| 18 |
use t::lib::Mocks; |
18 |
use t::lib::Mocks; |
| 19 |
use Test::More tests => 48; |
19 |
use Test::More tests => 51; |
| 20 |
|
20 |
|
| 21 |
BEGIN { |
21 |
BEGIN { |
| 22 |
use_ok('C4::Serials'); |
22 |
use_ok('C4::Serials'); |
|
Lines 316-319
subtest "Do not generate an expected if one already exists" => sub {
Link Here
|
| 316 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); |
316 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); |
| 317 |
}; |
317 |
}; |
| 318 |
|
318 |
|
|
|
319 |
#Unit test Bug 16116 |
| 320 |
|
| 321 |
$frequency_id = AddSubscriptionFrequency({ description => "Test frequency 1",unit => 'week', unitsperissue => 1, issuesperunit => 1 }); |
| 322 |
$subscriptionid = NewSubscription( |
| 323 |
undef, "", undef, undef, $budget_id, $biblionumber, |
| 324 |
'2013-01-01', $frequency_id, undef, undef, undef, |
| 325 |
undef, undef, undef, undef, undef, undef, |
| 326 |
1, $notes,undef, '2013-01-01', undef, $pattern_id, |
| 327 |
undef, undef, 0, $internalnotes, 0, |
| 328 |
undef, undef, 0, undef, '2013-12-31', 0 |
| 329 |
); |
| 330 |
#Week |
| 331 |
my($year, $month, $day) = ('2016','1','11'); |
| 332 |
$subscription = GetSubscription( $subscriptionid ); |
| 333 |
my $frequencudata = GetSubscriptionFrequency($subscription->{'periodicity'}); |
| 334 |
($year, $month, $day) = _get_next_date_week($subscription,$frequencudata, $year, $month, $day); |
| 335 |
is ("$year-$month-$day","2016-1-18","_get_next_date_week return right next date "); |
| 336 |
|
| 337 |
#Month |
| 338 |
ModSubscriptionFrequency({ id => $frequency_id, description => "Test frequency 1",unit => 'month', unitsperissue => 1, issuesperunit => 1 }); |
| 339 |
($year, $month, $day) = ('2016','1','11'); |
| 340 |
($year, $month, $day) = _get_next_date_month($subscription,$frequencudata, $year, $month, $day); |
| 341 |
is ("$year-$month-$day","2016-2-11","_get_next_date_month return right next date"); |
| 342 |
|
| 343 |
#Year |
| 344 |
ModSubscriptionFrequency({ id => $frequency_id, description => "Test frequency 1",unit => 'year', unitsperissue => 1, issuesperunit => 1 }); |
| 345 |
($year, $month, $day) = ('2016','1','11'); |
| 346 |
($year, $month, $day) = _get_next_date_year($subscription,$frequencudata, $year, $month, $day); |
| 347 |
is ("$year-$month-$day","2017-1-11","_get_next_date_year return right next date"); |
| 348 |
|
| 319 |
$dbh->rollback; |
349 |
$dbh->rollback; |
| 320 |
- |
|
|