From: Galen Charlton Date: Mon, 21 Oct 2013 23:34:46 +0000 (+0000) Subject: Bug 8037: (follow-up) improve GetBudgetByOrderNumber test X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=8c60cd41a84453f4edd7a8e8752860066fac6d32;p=koha.git Bug 8037: (follow-up) improve GetBudgetByOrderNumber test This patch moves the GetBudgetByOrderNumber() test from Budgets.t to Acquisition.t, thereby making it easier to test without doing a direct SQL insert into the aqorders table. To test: [1] Verify that prove -v t/db_dependent/Budgets.t passes [2] Verify that prove -v t/db_dependent/Acquisition.t passes Signed-off-by: Galen Charlton --- diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t index 2b36068cb7..e7fc32ea6d 100755 --- a/t/db_dependent/Acquisition.t +++ b/t/db_dependent/Acquisition.t @@ -8,7 +8,7 @@ use POSIX qw(strftime); use C4::Bookseller qw( GetBookSellerFromId ); -use Test::More tests => 59; +use Test::More tests => 60; BEGIN { use_ok('C4::Acquisition'); @@ -87,6 +87,8 @@ my $orders = SearchOrders({ isa_ok( $orders, 'ARRAY' ); is(scalar(@$orders), 3, 'retrieved 3 pending orders'); +ok( GetBudgetByOrderNumber($ordernumber1)->{'budget_id'} eq $budgetid, "GetBudgetByOrderNumber returns expected budget" ); + C4::Acquisition::CloseBasket( $basketno ); my @lateorders = GetLateOrders(0); my $order = $lateorders[0]; diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index 7c7d38677a..bfb910bf63 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -92,10 +92,6 @@ ok($budget_id=AddBudget( #| budget_owner_id | int(11) | YES | | NULL | | #| budget_permission | int(1) | YES | | 0 | | -C4::Context::dbh->do('INSERT INTO aqorders ( ordernumber, budget_id ) VALUES ( 987654321, ? )', {}, ( $budget_id ) ); -ok( GetBudgetByOrderNumber( '987654321' )->{'budget_id'} eq $budget_id, "GetBudgetByOrderNumber returns valid data" ); -C4::Context::dbh->do('DELETE FROM aqorders WHERE ordernumber = 987654321'); - my $budget; ok($budget=GetBudget($budget_id) ,"GetBudget OK"); $$budget{budget_permission}=1;