Lines 1-5
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
use Test::More tests => 130; |
2 |
use Test::More tests => 133; |
3 |
|
3 |
|
4 |
BEGIN { |
4 |
BEGIN { |
5 |
use_ok('C4::Budgets') |
5 |
use_ok('C4::Budgets') |
Lines 623-628
is( C4::Budgets::GetBudget($budget_id2)->{budget_owner_id},
Link Here
|
623 |
is( C4::Budgets::GetBudget($budget_id21)->{budget_owner_id}, |
623 |
is( C4::Budgets::GetBudget($budget_id21)->{budget_owner_id}, |
624 |
undef, "SetOwnerToFundHierarchy should have set John Doe $john_doe for budget 21 ($budget_id21)" ); |
624 |
undef, "SetOwnerToFundHierarchy should have set John Doe $john_doe for budget 21 ($budget_id21)" ); |
625 |
|
625 |
|
|
|
626 |
# Test GetBudgetAuthCats |
627 |
|
628 |
my $budgetPeriodId = 1; |
629 |
|
630 |
my $bdgts = GetBudgets(); |
631 |
my $i = 0; |
632 |
for my $budget ( @{$bdgts} ) |
633 |
{ |
634 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
635 |
$budget->{sort2_authcat} = "sort2_authcat_$i"; |
636 |
$budget->{budget_period_id} = $budgetPeriodId; |
637 |
ModBudget( $budget ); |
638 |
$i++; |
639 |
} |
640 |
|
641 |
my $authCat = GetBudgetAuthCats($budgetPeriodId); |
642 |
|
643 |
is( scalar @{$authCat}, $i * 2, "GetBudgetAuthCats returns only non-empty sorting categories (no empty authCat in db)" ); |
644 |
|
645 |
$i = 0; |
646 |
for my $budget ( @{$bdgts} ) |
647 |
{ |
648 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
649 |
$budget->{sort2_authcat} = ""; |
650 |
$budget->{budget_period_id} = $budgetPeriodId; |
651 |
ModBudget( $budget ); |
652 |
$i++; |
653 |
} |
654 |
|
655 |
$authCat = GetBudgetAuthCats($budgetPeriodId); |
656 |
|
657 |
is( scalar @{$authCat}, $i, "GetBudgetAuthCats returns only non-empty sorting categories (empty sort2_authcat on all records)" ); |
658 |
|
659 |
$i = 0; |
660 |
for my $budget ( @{$bdgts} ) |
661 |
{ |
662 |
$budget->{sort1_authcat} = ""; |
663 |
$budget->{sort2_authcat} = ""; |
664 |
$budget->{budget_period_id} = $budgetPeriodId; |
665 |
ModBudget( $budget ); |
666 |
$i++; |
667 |
} |
668 |
|
669 |
$authCat = GetBudgetAuthCats($budgetPeriodId); |
670 |
|
671 |
is( scalar @{$authCat}, 0, "GetBudgetAuthCats returns only non-empty sorting categories (all empty)" ); |
672 |
|
673 |
# /Test GetBudgetAuthCats |
674 |
|
626 |
sub _get_dependencies { |
675 |
sub _get_dependencies { |
627 |
my ($budget_hierarchy) = @_; |
676 |
my ($budget_hierarchy) = @_; |
628 |
my $graph; |
677 |
my $graph; |
629 |
- |
|
|