Bugzilla – Attachment 40184 Details for
Bug 14334
DBI fighting DBIx over Autocommit in tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[ FOR DISCUSSION ] Bug 14334: Add a Database module for db dependent tests
Bug-14334-Add-a-Database-module-for-db-dependent-t.patch (text/plain), 1.89 KB, created by
Jonathan Druart
on 2015-06-16 14:31:03 UTC
(
hide
)
Description:
[ FOR DISCUSSION ] Bug 14334: Add a Database module for db dependent tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-06-16 14:31:03 UTC
Size:
1.89 KB
patch
obsolete
>From aa284f2efb2915514f77791cdc1bc73d54561057 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@koha-community.org> >Date: Tue, 16 Jun 2015 16:30:01 +0200 >Subject: [PATCH] Bug 14334: Add a Database module for db dependent tests > >--- > t/db_dependent/Acquisition.t | 10 ++-------- > t/lib/Database.pm | 19 +++++++++++++++++++ > 2 files changed, 21 insertions(+), 8 deletions(-) > create mode 100644 t/lib/Database.pm > >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 83486d2..e73e848 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -20,7 +20,7 @@ use Modern::Perl; > use POSIX qw(strftime); > > use Test::More tests => 87; >-use Koha::Database; >+use t::lib::Database; > > BEGIN { > use_ok('C4::Acquisition'); >@@ -118,11 +118,7 @@ sub _check_fields_of_orders { > } > > >-my $schema = Koha::Database->new()->schema(); >-$schema->storage->txn_begin(); >- >-my $dbh = C4::Context->dbh; >-$dbh->{RaiseError} = 1; >+my $dbh = t::lib::Database::dbh; > > # Creating some orders > my $booksellerid = C4::Bookseller::AddBookseller( >@@ -920,5 +916,3 @@ ok((defined $order4->{datecancellationprinted}), "order is cancelled"); > ok(($order4->{cancellationreason} eq "foobar"), "order has cancellation reason \"foobar\""); > ok((not defined GetBiblio($order4->{biblionumber})), "biblio does not exist anymore"); > # End of tests for DelOrder >- >-$schema->storage->txn_rollback(); >diff --git a/t/lib/Database.pm b/t/lib/Database.pm >new file mode 100644 >index 0000000..2106d61 >--- /dev/null >+++ b/t/lib/Database.pm >@@ -0,0 +1,19 @@ >+package t::lib::Database; >+ >+use C4::Context; >+use Koha::Database; >+ >+sub dbh { >+ my $dbh = C4::Context->dbh; >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ $dbh->{RaiseError} = 1; >+ return $dbh; >+} >+ >+END { >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_rollback; >+}; >+ >+1; >-- >2.1.0
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 14334
:
39871
|
39872
|
39873
|
39874
|
39875
|
39876
|
39877
|
39879
|
39880
|
39881
|
39882
|
39883
|
39884
|
39885
|
40080
|
40086
|
40184
|
82989
|
83129
|
83201