View | Details | Raw Unified | Return to bug 23195
Collapse All | Expand All

(-)a/t/db_dependent/Budgets.t (-3 / +33 lines)
Lines 816-823 is( scalar @{$authCat}, 0, "GetBudgetAuthCats returns only non-empty sorting cat Link Here
816
816
817
# /Test GetBudgetAuthCats
817
# /Test GetBudgetAuthCats
818
818
819
subtest 'GetBudgetSpent and GetBudgetOrdered' => sub {
819
subtest 'GetBudgetSpent and GetBudgetOrdered and GetBudgetHierarchy shipping and adjustments' => sub {
820
    plan tests => 20;
820
    plan tests => 26;
821
821
822
    my $budget_period = $builder->build({
822
    my $budget_period = $builder->build({
823
        source => 'Aqbudgetperiod',
823
        source => 'Aqbudgetperiod',
Lines 957-962 subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { Link Here
957
    is( $ordered, 3, "After adding invoice adjustment on a child budget, should still be 3 ordered/budget unaffected");
957
    is( $ordered, 3, "After adding invoice adjustment on a child budget, should still be 3 ordered/budget unaffected");
958
    is( @$hierarchy[0]->{total_spent},9,"After adding invoice adjustment on child budget, budget hierarchy shows 9 spent");
958
    is( @$hierarchy[0]->{total_spent},9,"After adding invoice adjustment on child budget, budget hierarchy shows 9 spent");
959
    is( @$hierarchy[0]->{total_ordered},6,"After adding invoice adjustment on child budget, budget hierarchy shows 6 ordered");
959
    is( @$hierarchy[0]->{total_ordered},6,"After adding invoice adjustment on child budget, budget hierarchy shows 6 ordered");
960
961
    my $invoice_3 = $builder->build({
962
        source => 'Aqinvoice',
963
        value  => {
964
            closedate => '2017-07-01',
965
            shipmentcost_budgetid => $budget0->{budget_id},
966
            shipmentcost           => 1.25
967
        }
968
    });
969
    my $invoice_4 = $builder->build({
970
        source => 'Aqinvoice',
971
        value  => {
972
            closedate => '2017-07-01',
973
            shipmentcost_budgetid => $budget0->{budget_id},
974
            shipmentcost           => 1.75
975
        }
976
    });
977
978
    $spent = GetBudgetSpent( $budget->{budget_id} );
979
    $ordered = GetBudgetOrdered( $budget->{budget_id} );
980
    is( $spent, 6, "After adding invoice shipment cost on open and closed invoice on child, neither are counted as spent from parent");
981
    is( $ordered, 3, "After adding invoice shipment cost on open and closed invoice, neither are counted as ordered from parent");
982
    $spent = GetBudgetSpent( $budget0->{budget_id} );
983
    $ordered = GetBudgetOrdered( $budget0->{budget_id} );
984
    is( $spent, 6, "After adding invoice shipment cost on open and closed invoice on child, both are counted as spent from child");
985
    is( $ordered, 3, "After adding invoice shipment cost on open and closed invoice, neither are counted as ordered from child");
986
    $hierarchy = GetBudgetHierarchy($budget_period->{budget_period_id} );
987
    is( @$hierarchy[0]->{total_spent},12,"After adding shipmentcost on child, budget hierarchy shows 12 spent total");
988
    is( @$hierarchy[0]->{total_ordered},6,"After adding shipmentcost on child, budget hierarchy still shows 6 ordered total");
989
990
960
};
991
};
961
992
962
subtest 'GetBudgetSpent GetBudgetOrdered GetBudgetsPlanCell tests' => sub {
993
subtest 'GetBudgetSpent GetBudgetOrdered GetBudgetsPlanCell tests' => sub {
963
- 

Return to bug 23195