Bug 37898: Wrap labels tests inside transactions
This tests are written in a way that the cleanup is done explicitly. So I found no evidence of them leaving the database dirty. But it felt worth wrapping anyway, because any dev adding something could easily introduce new data inadvertedly. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
b41fa9b487
commit
e052614d7f
3 changed files with 18 additions and 0 deletions
|
@ -20,12 +20,17 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 58;
|
||||
|
||||
use C4::Context;
|
||||
use Koha::Database;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Labels::Layout');
|
||||
}
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $default_layout = {
|
||||
barcode_type => 'CODE39',
|
||||
callnum_split => 0,
|
||||
|
@ -118,3 +123,4 @@ is($updated_layout->get_text_wrap_cols(label_width => 180, left_text_margin => 1
|
|||
my $del_results = $updated_layout->delete();
|
||||
ok( ! defined($del_results) , "Layout->delete() success");
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 27;
|
||||
|
||||
use C4::Context;
|
||||
use Koha::Database;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Labels::Profile');
|
||||
}
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $expected_profile = {
|
||||
creator => 'Labels',
|
||||
printer_name => 'Circulation Desk',
|
||||
|
@ -95,3 +100,4 @@ is_deeply($updated_profile, $saved_profile, "Updated layout object verify succes
|
|||
my $del_results = $updated_profile->delete();
|
||||
ok($del_results ne -1, "Profile->delete() success");
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 54;
|
||||
|
||||
use C4::Context;
|
||||
use Koha::Database;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Labels::Template');
|
||||
}
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $expect_template = {
|
||||
creator => 'Labels',
|
||||
profile_id => 0,
|
||||
|
@ -135,3 +140,4 @@ foreach my $key (keys %{$expect_conv}) {
|
|||
my $del_results = $updated_template->delete();
|
||||
ok($del_results ne -1, "Template->delete() success");
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
Loading…
Reference in a new issue