Bug 16609: Catch warning from Koha::Hold in Hold.t
[koha.git] / t / db_dependent / Acquisition.t
index cd3f125..7c80387 100755 (executable)
@@ -19,7 +19,7 @@ use Modern::Perl;
 
 use POSIX qw(strftime);
 
-use Test::More tests => 87;
+use Test::More tests => 91;
 use Koha::Database;
 
 BEGIN {
@@ -147,10 +147,18 @@ ok(
 );
 ok( $basket = GetBasket($basketno), "GetBasket($basketno) returns $basket" );
 
+my $bpid=AddBudgetPeriod({
+        budget_period_startdate => '2008-01-01'
+        , budget_period_enddate => '2008-12-31'
+        , budget_period_active  => 1
+        , budget_period_description    => "MAPERI"
+});
+
 my $budgetid = C4::Budgets::AddBudget(
     {
         budget_code => "budget_code_test_getordersbybib",
         budget_name => "budget_name_test_getordersbybib",
+        budget_period_id => $bpid,
     }
 );
 my $budget = C4::Budgets::GetBudget($budgetid);
@@ -351,7 +359,6 @@ my @expectedfields = qw(
   gstrate
   discount
   budget_id
-  budgetgroup_id
   budgetdate
   sort1
   sort2
@@ -479,7 +486,6 @@ my @base_expectedfields = qw(
   publicationyear
   collectiontitle
   invoiceid
-  budgetgroup_id
   place
   issn
   quantityreceived
@@ -601,7 +607,6 @@ ok(
   title
   closedate
   basketname
-  budgetgroup_id
   invoiceid
   author
   parent_ordernumber
@@ -933,4 +938,14 @@ ok(($order4->{cancellationreason} eq "foobar"), "order has cancellation reason \
 ok((not defined GetBiblio($order4->{biblionumber})), "biblio does not exist anymore");
 # End of tests for DelOrder
 
+# Budget reports
+my $all_count = scalar GetBudgetsReport();
+ok($all_count >= 1, "GetBudgetReport OK");
+
+my $active_count = scalar GetBudgetsReport(1);
+ok($active_count >= 1 , "GetBudgetsReport(1) OK");
+
+is($all_count, scalar GetBudgetsReport(), "GetBudgetReport returns inactive budget period acquisitions.");
+ok($active_count >= scalar GetBudgetsReport(1), "GetBudgetReport doesn't return inactive budget period acquisitions.");
+
 $schema->storage->txn_rollback();