Bugzilla – Attachment 65050 Details for
Bug 18941
C4::Budgets GetBudgetByCode should return active budgets over inactive budgets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18941 - Unit tests
Bug-18941---Unit-tests.patch (text/plain), 2.50 KB, created by
Nick Clemens (kidclamp)
on 2017-07-14 11:31:23 UTC
(
hide
)
Description:
Bug 18941 - Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-07-14 11:31:23 UTC
Size:
2.50 KB
patch
obsolete
>From 9b9545327faad7c3fca1e71efc7a8bedf9c05f77 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 14 Jul 2017 11:06:16 +0000 >Subject: [PATCH] Bug 18941 - Unit tests > >--- > t/db_dependent/Budgets.t | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index d19dedf..20c4293 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -117,7 +117,8 @@ is( AddBudget(), undef, 'AddBuget without argument returns undef' ); > my $budgets = GetBudgets(); > is( @$budgets, 0, 'GetBudgets returns the correct number of budgets' ); > >-$bpid = AddBudgetPeriod($my_budgetperiod); >+$bpid = AddBudgetPeriod($my_budgetperiod); #this is an active budget >+ > my $my_budget = { > budget_code => 'ABCD', > budget_amount => '123.132000', >@@ -176,9 +177,26 @@ is( @$budgets, 1, 'GetBudgets With Order Getting Active budgetPeriod OK'); > my $budget_name = GetBudgetName( $budget_id ); > is($budget_name, $my_budget->{budget_name}, "Test the GetBudgetName routine"); > >+my $my_inactive_budgetperiod = { #let's add an inactive >+ budget_period_startdate => '2010-01-01', >+ budget_period_enddate => '2010-12-31', >+ budget_period_description => 'MODIF_MAPERI', >+ budget_period_active => 0, >+}; >+my $bpid_i = AddBudgetPeriod($my_inactive_budgetperiod); #this is an inactive budget >+ >+my $my_budget_inactive = { >+ budget_code => 'ABCD', >+ budget_amount => '123.132000', >+ budget_name => 'Periodiques', >+ budget_notes => 'This is a note', >+ budget_period_id => $bpid_i, >+}; >+my $budget_id_inactive = AddBudget($my_budget_inactive); >+ > my $budget_code = $my_budget->{budget_code}; > my $budget_by_code = GetBudgetByCode( $budget_code ); >-is($budget_by_code->{budget_id}, $budget_id, "GetBudgetByCode, check id"); >+is($budget_by_code->{budget_id}, $budget_id, "GetBudgetByCode, check id"); #this should match the active budget, not the inactive > is($budget_by_code->{budget_notes}, $my_budget->{budget_notes}, "GetBudgetByCode, check notes"); > > my $second_budget_id = AddBudget({ >@@ -195,7 +213,7 @@ ok( $budgets->[0]->{budget_name} lt $budgets->[1]->{budget_name}, 'default sort > > is( DelBudget($budget_id), 1, 'DelBudget returns true' ); > $budgets = GetBudgets(); >-is( @$budgets, 1, 'GetBudgets returns the correct number of budget periods' ); >+is( @$budgets, 2, 'GetBudgets returns the correct number of budget periods' ); > > > # GetBudgetHierarchySpent and GetBudgetHierarchyOrdered >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18941
:
65049
|
65050
|
65125
|
65126
|
65441
|
65442
|
65847
|
65848