Bug 16561 - Bug 15877 followup to fix tests
When I altered the tests to avoid accidental deletion of all items, I didn't rollback the transaction, hence the tests now delete all items from a db when run. This patch rollsback the transaction so items are not deleted from your db To test: 1 - Backup your db 2 - prove -v t/db_dependent/Barcodes.t 3 - Note that all items and issues are deleted from the DB 4 - Restore your DB 5 - Apply this patch 6 - prove -v t/db_dependent/Barcodes.t 7 - Your DB should eb unchanged Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
3bf5a05695
commit
ff898e8833
1 changed files with 5 additions and 4 deletions
|
@ -32,17 +32,15 @@ BEGIN {
|
|||
use_ok('C4::Barcodes');
|
||||
}
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $schema = Koha::Database->new->schema;
|
||||
|
||||
subtest 'Test generation of annual barcodes from DB values' => sub {
|
||||
|
||||
plan tests => 4;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
$builder->schema->resultset( 'Issue' )->delete_all;
|
||||
$builder->schema->resultset( 'Item' )->delete_all;
|
||||
|
||||
|
@ -83,6 +81,7 @@ subtest 'Test generation of annual barcodes from DB values' => sub {
|
|||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
$builder->schema->resultset( 'Issue' )->delete_all;
|
||||
$builder->schema->resultset( 'Item' )->delete_all;
|
||||
|
@ -171,3 +170,5 @@ foreach $format (@formats) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
Loading…
Reference in a new issue