Lines 1-5
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
use Test::More tests => 27; |
2 |
use Test::More tests => 31; |
3 |
|
3 |
|
4 |
BEGIN {use_ok('C4::Budgets') } |
4 |
BEGIN {use_ok('C4::Budgets') } |
5 |
use C4::Context; |
5 |
use C4::Context; |
Lines 341-347
is(
Link Here
|
341 |
is_deeply( |
341 |
is_deeply( |
342 |
_get_dependencies($budget_hierarchy), |
342 |
_get_dependencies($budget_hierarchy), |
343 |
_get_dependencies($budget_hierarchy_cloned), |
343 |
_get_dependencies($budget_hierarchy_cloned), |
344 |
'CloneBudgetPeriod keep the same dependencies order' |
344 |
'CloneBudgetPeriod keeps the same dependencies order' |
|
|
345 |
); |
346 |
|
347 |
# CloneBudgetPeriod with param mark_original_budget_as_inactive |
348 |
my $budget_period = C4::Budgets::GetBudgetPeriod($budget_period_id); |
349 |
is( $budget_period->{budget_period_active}, 1, |
350 |
'CloneBudgetPeriod does not mark as inactive the budgetperiod if not needed' |
351 |
); |
352 |
|
353 |
$budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( |
354 |
{ |
355 |
budget_period_id => $budget_period_id, |
356 |
budget_period_startdate => '2014-01-01', |
357 |
budget_period_enddate => '2014-12-31', |
358 |
mark_original_budget_as_inactive => 1, |
359 |
} |
360 |
); |
361 |
|
362 |
$budget_hierarchy = GetBudgetHierarchy($budget_period_id); |
363 |
$budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); |
364 |
|
365 |
is( scalar(@$budget_hierarchy_cloned), scalar(@$budget_hierarchy), |
366 |
'CloneBudgetPeriod (with inactive param) clones the same number of budgets (funds)' |
367 |
); |
368 |
is_deeply( |
369 |
_get_dependencies($budget_hierarchy), |
370 |
_get_dependencies($budget_hierarchy_cloned), |
371 |
'CloneBudgetPeriod (with inactive param) keeps the same dependencies order' |
372 |
); |
373 |
$budget_period = C4::Budgets::GetBudgetPeriod($budget_period_id); |
374 |
is( $budget_period->{budget_period_active}, 0, |
375 |
'CloneBudgetPeriod (with inactive param) marks as inactive the budgetperiod' |
345 |
); |
376 |
); |
346 |
|
377 |
|
347 |
sub _get_dependencies { |
378 |
sub _get_dependencies { |
348 |
- |
|
|