Lines 1-5
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
use Test::More tests => 133; |
2 |
use Test::More tests => 134; |
3 |
|
3 |
|
4 |
BEGIN { |
4 |
BEGIN { |
5 |
use_ok('C4::Budgets') |
5 |
use_ok('C4::Budgets') |
Lines 625-635
is( C4::Budgets::GetBudget($budget_id21)->{budget_owner_id},
Link Here
|
625 |
|
625 |
|
626 |
# Test GetBudgetAuthCats |
626 |
# Test GetBudgetAuthCats |
627 |
|
627 |
|
628 |
my $budgetPeriodId = 1; |
628 |
my $budgetPeriodId = AddBudgetPeriod({ |
|
|
629 |
budget_period_startdate => '2008-01-01', |
630 |
budget_period_enddate => '2008-12-31', |
631 |
budget_period_description => 'just another budget', |
632 |
budget_period_active => 0, |
633 |
}); |
629 |
|
634 |
|
630 |
my $bdgts = GetBudgets(); |
635 |
$budgets = GetBudgets(); |
631 |
my $i = 0; |
636 |
my $i = 0; |
632 |
for my $budget ( @{$bdgts} ) |
637 |
for my $budget ( @$budgets ) |
633 |
{ |
638 |
{ |
634 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
639 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
635 |
$budget->{sort2_authcat} = "sort2_authcat_$i"; |
640 |
$budget->{sort2_authcat} = "sort2_authcat_$i"; |
Lines 643-649
my $authCat = GetBudgetAuthCats($budgetPeriodId);
Link Here
|
643 |
is( scalar @{$authCat}, $i * 2, "GetBudgetAuthCats returns only non-empty sorting categories (no empty authCat in db)" ); |
648 |
is( scalar @{$authCat}, $i * 2, "GetBudgetAuthCats returns only non-empty sorting categories (no empty authCat in db)" ); |
644 |
|
649 |
|
645 |
$i = 0; |
650 |
$i = 0; |
646 |
for my $budget ( @{$bdgts} ) |
651 |
for my $budget ( @$budgets ) |
|
|
652 |
{ |
653 |
$budget->{sort1_authcat} = "sort_authcat_$i"; |
654 |
$budget->{sort2_authcat} = "sort_authcat_$i"; |
655 |
$budget->{budget_period_id} = $budgetPeriodId; |
656 |
ModBudget( $budget ); |
657 |
$i++; |
658 |
} |
659 |
|
660 |
$authCat = GetBudgetAuthCats($budgetPeriodId); |
661 |
is( scalar @$authCat, scalar @$budgets, "GetBudgetAuthCats returns distinct authCat" ); |
662 |
|
663 |
$i = 0; |
664 |
for my $budget ( @$budgets ) |
647 |
{ |
665 |
{ |
648 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
666 |
$budget->{sort1_authcat} = "sort1_authcat_$i"; |
649 |
$budget->{sort2_authcat} = ""; |
667 |
$budget->{sort2_authcat} = ""; |
Lines 657-663
$authCat = GetBudgetAuthCats($budgetPeriodId);
Link Here
|
657 |
is( scalar @{$authCat}, $i, "GetBudgetAuthCats returns only non-empty sorting categories (empty sort2_authcat on all records)" ); |
675 |
is( scalar @{$authCat}, $i, "GetBudgetAuthCats returns only non-empty sorting categories (empty sort2_authcat on all records)" ); |
658 |
|
676 |
|
659 |
$i = 0; |
677 |
$i = 0; |
660 |
for my $budget ( @{$bdgts} ) |
678 |
for my $budget ( @$budgets ) |
661 |
{ |
679 |
{ |
662 |
$budget->{sort1_authcat} = ""; |
680 |
$budget->{sort1_authcat} = ""; |
663 |
$budget->{sort2_authcat} = ""; |
681 |
$budget->{sort2_authcat} = ""; |
664 |
- |
|
|