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

(-)a/t/db_dependent/TestBuilder.t (+9 lines)
Lines 18-29 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
use Test::More tests => 41;
22
use Test::More tests => 41;
22
23
24
use Koha::Database;
25
23
BEGIN {
26
BEGIN {
24
    use_ok('t::lib::TestBuilder');
27
    use_ok('t::lib::TestBuilder');
25
}
28
}
26
29
30
my $schema  = Koha::Database->new->schema;
31
$schema->storage->txn_begin;
27
32
28
my $builder = t::lib::TestBuilder->new();
33
my $builder = t::lib::TestBuilder->new();
29
34
Lines 251-253 $bookseller = $builder->build({ Link Here
251
delete $bookseller->{_fk};
256
delete $bookseller->{_fk};
252
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
257
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
253
is( $bookseller_from_db->in_storage, 1, 'build with only_fk = 0 stores the entry correctly' );
258
is( $bookseller_from_db->in_storage, 1, 'build with only_fk = 0 stores the entry correctly' );
259
260
$schema->storage->txn_rollback;
261
262
1;
(-)a/t/lib/TestBuilder.pm (-13 / +1 lines)
Lines 72-81 sub new { Link Here
72
    bless( $self, $class );
72
    bless( $self, $class );
73
73
74
    $self->schema( Koha::Database->new()->schema );
74
    $self->schema( Koha::Database->new()->schema );
75
    eval {
76
        $self->schema->txn_begin();
77
    };
78
    $self->schema->storage->sql_maker->quote_char('`');
75
    $self->schema->storage->sql_maker->quote_char('`');
76
79
    return $self;
77
    return $self;
80
}
78
}
81
79
Lines 356-370 sub _gen_blob { Link Here
356
    return 'b';
354
    return 'b';
357
}
355
}
358
356
359
360
sub DESTROY {
361
    my $self = shift;
362
    eval {
363
        $self->schema->txn_rollback();
364
    };
365
}
366
367
368
=head1 NAME
357
=head1 NAME
369
358
370
t::lib::TestBuilder.pm - Koha module to simplify the writing of tests
359
t::lib::TestBuilder.pm - Koha module to simplify the writing of tests
371
- 

Return to bug 15081