Bug 10535: (follow-up) add test case
authorGalen Charlton <gmc@esilibrary.com>
Thu, 11 Jul 2013 16:51:40 +0000 (16:51 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 17 Oct 2013 23:06:44 +0000 (23:06 +0000)
This adds a test case for the new default sort
order for GetBudgets().

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/db_dependent/Budgets.t

index 717f8fe..baaa1a1 100755 (executable)
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Test::More tests=>18;
+use Test::More tests=>20;
 
 BEGIN {use_ok('C4::Budgets') }
 use C4::Dates;
@@ -102,5 +102,22 @@ ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{"
 my $budget_name = GetBudgetName( $budget_id );
 is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine");
 
+my $second_budget_id;
+ok($second_budget_id=AddBudget(
+                        {   budget_code         => "ZZZZ",
+                            budget_amount       => "500.00",
+                            budget_name     => "Art",
+                            budget_notes        => "This is a note",
+                            budget_description=> "Art",
+                            budget_active       => 1,
+                            budget_period_id    => $bpid,
+                        }
+                       ),
+    "AddBudget returned $second_budget_id");
+
+my $budgets = GetBudgets({ budget_period_id => $bpid});
+ok($budgets->[0]->{budget_name} lt $budgets->[1]->{budget_name}, 'default sort order for GetBudgets is by name');
+
 ok($del_status=DelBudget($budget_id),
     "DelBudget returned $del_status");
+