Bug 14334: t/db_dependent/Budgets.t AutoCommit fix

TEST PLAN
----------
1) git reset --hard origin/master
2) prove t/db_dependent/Budgets.t
   -- horrible failure about transaction
3) apply this patch
4) prove t/db_dependent/Budgets.t
   -- no issues
5) koha qa test tools.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Mark Tompsett 2015-06-04 16:08:22 -04:00 committed by Tomas Cohen Arazi
parent 7f4a7f2eb3
commit af6bb0b4db

View file

@ -12,10 +12,13 @@ use C4::Dates;
use C4::Members qw( AddMember );
use Koha::Acquisition::Order;
use Koha::Database;
use YAML;
my $dbh = C4::Context->dbh;
$dbh->{AutoCommit} = 0;
my $database = Koha::Database->new();
my $schema = $database->schema();
$schema->storage->txn_begin();
$dbh->{RaiseError} = 1;
$dbh->do(q|DELETE FROM aqbudgetperiods|);
@ -579,6 +582,8 @@ is( C4::Budgets::GetBudget($budget_id2)->{budget_owner_id},
is( C4::Budgets::GetBudget($budget_id21)->{budget_owner_id},
undef, "SetOwnerToFundHierarchy should have set John Doe $john_doe for budget 21 ($budget_id21)" );
$schema->storage->txn_rollback();
sub _get_dependencies {
my ($budget_hierarchy) = @_;
my $graph;