View | Details | Raw Unified | Return to bug 18826
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/holds.t (-5 / +9 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Test::More tests => 4;
20
use Test::More tests => 4;
21
use Test::Mojo;
21
use Test::Mojo;
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
use t::lib::Mocks;
23
24
24
use DateTime;
25
use DateTime;
25
26
Lines 31-41 use Koha::Biblios; Link Here
31
use Koha::Items;
32
use Koha::Items;
32
use Koha::Patrons;
33
use Koha::Patrons;
33
34
35
my $schema  = Koha::Database->new->schema;
34
my $builder = t::lib::TestBuilder->new();
36
my $builder = t::lib::TestBuilder->new();
35
37
36
my $dbh = C4::Context->dbh;
38
$schema->storage->txn_begin;
37
$dbh->{AutoCommit} = 0;
39
38
$dbh->{RaiseError} = 1;
40
# FIXME: sessionStorage defaults to mysql, but it seems to break transaction handling
41
# this affects the other REST api tests
42
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' );
39
43
40
$ENV{REMOTE_ADDR} = '127.0.0.1';
44
$ENV{REMOTE_ADDR} = '127.0.0.1';
41
my $t = Test::Mojo->new('Koha::REST::V1');
45
my $t = Test::Mojo->new('Koha::REST::V1');
Lines 113-118 my $itemnumber = create_item($biblionumber, 'TEST000001'); Link Here
113
my $biblionumber2 = create_biblio('RESTful Web APIs');
117
my $biblionumber2 = create_biblio('RESTful Web APIs');
114
my $itemnumber2 = create_item($biblionumber2, 'TEST000002');
118
my $itemnumber2 = create_item($biblionumber2, 'TEST000002');
115
119
120
my $dbh = C4::Context->dbh;
116
$dbh->do('DELETE FROM reserves');
121
$dbh->do('DELETE FROM reserves');
117
$dbh->do('DELETE FROM issuingrules');
122
$dbh->do('DELETE FROM issuingrules');
118
    $dbh->do(q{
123
    $dbh->do(q{
Lines 303-310 subtest "Test endpoints with permission" => sub { Link Here
303
      ->json_like('/error', qr/tooManyReserves/);
308
      ->json_like('/error', qr/tooManyReserves/);
304
};
309
};
305
310
306
311
$schema->storage->txn_rollback;
307
$dbh->rollback;
308
312
309
sub create_biblio {
313
sub create_biblio {
310
    my ($title) = @_;
314
    my ($title) = @_;
(-)a/t/db_dependent/api/v1/patrons.t (-5 / +4 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Test::More tests => 21;
20
use Test::More tests => 21;
21
use Test::Mojo;
21
use Test::Mojo;
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
use t::lib::Mocks;
23
24
24
use C4::Auth;
25
use C4::Auth;
25
use C4::Context;
26
use C4::Context;
Lines 27-37 use C4::Context; Link Here
27
use Koha::Database;
28
use Koha::Database;
28
use Koha::Patron;
29
use Koha::Patron;
29
30
31
my $schema  = Koha::Database->new->schema;
30
my $builder = t::lib::TestBuilder->new();
32
my $builder = t::lib::TestBuilder->new();
31
33
32
my $dbh = C4::Context->dbh;
34
$schema->storage->txn_begin;
33
$dbh->{AutoCommit} = 0;
34
$dbh->{RaiseError} = 1;
35
35
36
$ENV{REMOTE_ADDR} = '127.0.0.1';
36
$ENV{REMOTE_ADDR} = '127.0.0.1';
37
my $t = Test::Mojo->new('Koha::REST::V1');
37
my $t = Test::Mojo->new('Koha::REST::V1');
Lines 131-134 $t->request_ok($tx) Link Here
131
  ->json_is('/surname' => $borrower->{ surname })
131
  ->json_is('/surname' => $borrower->{ surname })
132
  ->json_is('/lost' => 1 );
132
  ->json_is('/lost' => 1 );
133
133
134
$dbh->rollback;
134
$schema->storage->txn_rollback;
135
- 

Return to bug 18826