Bug 18991: [QA Follow-up] Use schema txn_begin and txn_rollback

We also need just one rollback at the end here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5e5402f36)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9908a18e92)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Marcel de Rooy 2017-07-28 11:58:24 +02:00 committed by Katrin Fischer
parent 18d8784cf0
commit 489794bbe9
1 changed files with 4 additions and 7 deletions

View File

@ -8,6 +8,7 @@ use Modern::Perl;
use Test::More tests => 10;
use C4::Context;
use Koha::Database;
use Koha::DateUtils;
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog
@ -20,9 +21,9 @@ BEGIN {
my $success;
# Make sure we can rollback.
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
my $dbh = C4::Context->dbh;
$dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;
eval {
# FIXME: are we sure there is an member number 1?
@ -121,8 +122,6 @@ subtest 'logaction(): interface is correctly logged' => sub {
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'sip');
$logs = GetLogs();
is( @{$logs}[0]->{ interface }, 'sip', 'Passed interface is respected (sip)');
$dbh->rollback;
};
subtest 'GetLogs() respects interface filters' => sub {
@ -150,8 +149,6 @@ subtest 'GetLogs() respects interface filters' => sub {
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']);
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)');
$dbh->rollback;
};
$dbh->rollback;
$schema->storage->txn_rollback;