Bug 22349: Remove overzealous database deletions from test
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 15 Feb 2019 14:40:34 +0000 (14:40 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 27 Feb 2019 14:14:21 +0000 (09:14 -0500)
For no apparent reason a whole lot of data was being deleted inside a
transaction for each of the subtests in Koha/Acquisitions/Booksellers.t

This patch simply remove the deletions. To test, run the test before and
after applying the patch and they should all continue to pass.. If you
have a large number of booksellers, baskets, orders or subscriptions in
your database you may also see an decrease in the time it takes to run
the test.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/db_dependent/Koha/Acquisition/Booksellers.t

index 010993e..e3870cd 100644 (file)
@@ -39,11 +39,6 @@ subtest '->baskets() tests' => sub {
 
     $schema->storage->txn_begin();
 
-    # Delete existing data
-    $schema->resultset('Aqorder')->delete();
-    $schema->resultset('Aqbasket')->delete();
-    Koha::Acquisition::Booksellers->delete();
-    $schema->resultset('Subscription')->delete();
     my $patron = $builder->build_object({ class => 'Koha::Patrons' });
 
     my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
@@ -67,12 +62,6 @@ subtest '->subscriptions() tests' => sub {
 
     $schema->storage->txn_begin();
 
-    # Delete existing data
-    $schema->resultset('Aqorder')->delete();
-    $schema->resultset('Aqbasket')->delete();
-    Koha::Acquisition::Booksellers->delete();
-    $schema->resultset('Subscription')->delete();
-
     my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
     is( $vendor->subscriptions->count, 0, 'Vendor has no subscriptions' );
 
@@ -154,12 +143,6 @@ subtest '->contacts() tests' => sub {
 
     $schema->storage->txn_begin();
 
-    # Delete existing data
-    $schema->resultset('Aqorder')->delete();
-    $schema->resultset('Aqbasket')->delete();
-    Koha::Acquisition::Booksellers->delete();
-    $schema->resultset('Subscription')->delete();
-
     my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
 
     is( $vendor->contacts->count, 0, 'Vendor has no contacts' );