From 303a9aef80c3d878a85fea1a20e36ab6c4a55c44 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 15 Jul 2016 11:45:49 -0400 Subject: [PATCH] Bug 16868: Jonathan Druart testing dbh code I grabbed the code from bug 14334, and will use it here. prove t/db_dependent/Linker_FirstMatch.t will demonstrate it works. Signed-off-by: Mark Tompsett --- t/lib/Database.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 t/lib/Database.pm 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.4