From 57b34838ef1512808e26912f050026e9d1d6e55e Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Tue, 15 Sep 2020 10:11:33 +0000
Subject: [PATCH] Bug 26462: Don't delete existing data for tests

These tests generate their own items, patrons, and circ rules. Existing
system data will not affect the results of the tests. We do not need
to delete information.

You may be able to notice the difference in speed of tests depending on your system. It should
be faster after applying

To test:
1 - Before applying patch:
    prove -v t/db_dependent/Holds.t
2 - It passes
3 - Apply patch
4 - prove -v t/db_dependent/Holds.t
5 - It passes

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 t/db_dependent/Holds.t | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t
index 0cffe1501a..7ad86b9783 100755
--- a/t/db_dependent/Holds.t
+++ b/t/db_dependent/Holds.t
@@ -633,11 +633,6 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub {
 
     $schema->storage->txn_begin;
 
-    Koha::Holds->search->delete;
-    $dbh->do('DELETE FROM issues');
-    Koha::Items->search->delete;
-    Koha::Biblios->search->delete;
-
     my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } );
     my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
     my $patron   = $builder->build_object( { class => 'Koha::Patrons' } );
@@ -650,7 +645,6 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub {
     my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype });
     my $itemnumber_3 = $builder->build_sample_item({ library => $library->branchcode, biblionumber => $biblio_3->biblionumber})->itemnumber;
 
-    Koha::CirculationRules->search->delete;
     Koha::CirculationRules->set_rules(
         {
             categorycode => '*',
@@ -818,9 +812,6 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
 
     $schema->storage->txn_begin;
 
-    # Cleanup database
-    Koha::Holds->search->delete;
-    $dbh->do('DELETE FROM issues');
     Koha::CirculationRules->set_rule(
         {
             branchcode   => undef,
@@ -831,9 +822,6 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
         }
     );
 
-    Koha::Items->search->delete;
-    Koha::Biblios->search->delete;
-
     # Create item types
     my $itemtype1 = $builder->build_object( { class => 'Koha::ItemTypes' } );
     my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } );
@@ -1038,10 +1026,6 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
     plan tests => 9;
 
     $schema->storage->txn_begin;
-
-    # Cleanup database
-    Koha::Holds->search->delete;
-    $dbh->do('DELETE FROM issues');
     Koha::CirculationRules->set_rule(
         {
             branchcode   => undef,
@@ -1052,9 +1036,6 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
         }
     );
 
-    Koha::Items->search->delete;
-    Koha::Biblios->search->delete;
-
     # Create item types
     my $itemtype1 = $builder->build_object( { class => 'Koha::ItemTypes' } );
     my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } );
@@ -1260,9 +1241,6 @@ subtest 'non priority holds' => sub {
 
     $schema->storage->txn_begin;
 
-    # Cleanup database
-    Koha::Holds->search->delete;
-    $dbh->do('DELETE FROM issues');
     Koha::CirculationRules->set_rules(
         {
             branchcode   => undef,
-- 
2.11.0