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 32-42 use Koha::Biblioitems; Link Here
32
use Koha::Items;
33
use Koha::Items;
33
use Koha::Patrons;
34
use Koha::Patrons;
34
35
36
my $schema  = Koha::Database->new->schema;
35
my $builder = t::lib::TestBuilder->new();
37
my $builder = t::lib::TestBuilder->new();
36
38
37
my $dbh = C4::Context->dbh;
39
$schema->storage->txn_begin;
38
$dbh->{AutoCommit} = 0;
40
39
$dbh->{RaiseError} = 1;
41
# FIXME: sessionStorage defaults to mysql, but it seems to break transaction handling
42
# this affects the other REST api tests
43
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' );
40
44
41
$ENV{REMOTE_ADDR} = '127.0.0.1';
45
$ENV{REMOTE_ADDR} = '127.0.0.1';
42
my $t = Test::Mojo->new('Koha::REST::V1');
46
my $t = Test::Mojo->new('Koha::REST::V1');
Lines 114-119 my $itemnumber = create_item($biblionumber, 'TEST000001'); Link Here
114
my $biblionumber2 = create_biblio('RESTful Web APIs');
118
my $biblionumber2 = create_biblio('RESTful Web APIs');
115
my $itemnumber2 = create_item($biblionumber2, 'TEST000002');
119
my $itemnumber2 = create_item($biblionumber2, 'TEST000002');
116
120
121
my $dbh = C4::Context->dbh;
117
$dbh->do('DELETE FROM reserves');
122
$dbh->do('DELETE FROM reserves');
118
$dbh->do('DELETE FROM issuingrules');
123
$dbh->do('DELETE FROM issuingrules');
119
    $dbh->do(q{
124
    $dbh->do(q{
Lines 304-311 subtest "Test endpoints with permission" => sub { Link Here
304
      ->json_like('/error', qr/tooManyReserves/);
309
      ->json_like('/error', qr/tooManyReserves/);
305
};
310
};
306
311
307
312
$schema->storage->txn_rollback;
308
$dbh->rollback;
309
313
310
sub create_biblio {
314
sub create_biblio {
311
    my ($title) = @_;
315
    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