Revert "Bug 20985: Unit tests"
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 16 Jun 2021 12:44:14 +0000 (14:44 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 16 Jun 2021 12:44:14 +0000 (14:44 +0200)
This reverts commit 5600f7e23e40b72040bcf66d27f21b4107860cbe.

t/db_dependent/Reserves.t

index 55e273d..9f40862 100755 (executable)
@@ -17,7 +17,7 @@
 
 use Modern::Perl;
 
 
 use Modern::Perl;
 
-use Test::More tests => 68;
+use Test::More tests => 67;
 use Test::MockModule;
 use Test::Warn;
 
 use Test::MockModule;
 use Test::Warn;
 
@@ -188,7 +188,6 @@ Koha::CirculationRules->set_rules(
         rules        => {
             reservesallowed => 25,
             holds_per_record => 1,
         rules        => {
             reservesallowed => 25,
             holds_per_record => 1,
-            onshelfholds => 1,
         }
     }
 );
         }
     }
 );
@@ -988,76 +987,7 @@ subtest 'reserves.item_level_hold' => sub {
 
         $hold->delete;
     };
 
         $hold->delete;
     };
-};
-
-subtest 'OnShelfHoldAllowed test' => sub {
-    plan tests => 3;
-    $dbh->do('DELETE FROM circulation_rules');
-    my $biblio = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber;
-
-    # Create a helper item instance for testing
-    my $item = $builder->build_sample_item({ biblionumber => $biblio, library => $branch_1, itype => $itemtype });
-
-    Koha::CirculationRules->set_rules(
-        {
-            branchcode   => undef,
-            categorycode => undef,
-            itemtype     => undef,
-            rules        => {
-                reservesallowed => 25,
-                opacitemholds => 'Y',
-                onshelfholds => 1,
-            }
-        }
-        );
-
-    my $canreserve = C4::Reserves::CanItemBeReserved(
-        $patron->borrowernumber,
-        $item->itemnumber,
-        );
-
-    is( $canreserve->{status}, 'OK',
-        'item-level holds should be possible with onshelfholdallowed set to "Yes"' );
 
 
-    Koha::CirculationRules->set_rules(
-        {
-            branchcode   => undef,
-            categorycode => undef,
-            itemtype     => undef,
-            rules        => {
-                reservesallowed => 25,
-                opacitemholds => 'Y',
-                onshelfholds => '0',
-            }
-        });
-
-    $canreserve = C4::Reserves::CanItemBeReserved(
-        $patron->borrowernumber,
-        $item->itemnumber,
-        );
-
-    is( $canreserve->{status}, 'onShelfHoldsNotAllowed',
-        'item-level holds should not be possible with onshelfholdallowed set to "If any unavailable"' );
-
-    Koha::CirculationRules->set_rules(
-        {
-            branchcode   => undef,
-            categorycode => undef,
-            itemtype     => undef,
-            rules        => {
-                reservesallowed => 25,
-                opacitemholds => 'Y',
-                onshelfholds => '2',
-            }
-        });
-
-    $canreserve = C4::Reserves::CanItemBeReserved(
-        $patron->borrowernumber,
-        $item->itemnumber,
-        );
-
-    is( $canreserve->{status}, 'onShelfHoldsNotAllowed',
-        'item-level holds should not be possible with onshelfholdallowed set to "If all unavailable"' );
 };
 
 subtest 'MoveReserve additional test' => sub {
 };
 
 subtest 'MoveReserve additional test' => sub {
@@ -1297,17 +1227,6 @@ subtest 'AllowHoldOnPatronPossession test' => sub {
     my $patron = $builder->build_object({ class => "Koha::Patrons",
                                           value => { branchcode => $item->homebranch }});
 
     my $patron = $builder->build_object({ class => "Koha::Patrons",
                                           value => { branchcode => $item->homebranch }});
 
-    Koha::CirculationRules->set_rules(
-       {
-           branchcode   => undef,
-           categorycode => undef,
-           itemtype     => undef,
-           rules        => {
-               onshelfholds => 1,
-           }
-       }
-    );
-
     C4::Circulation::AddIssue($patron->unblessed,
                               $item->barcode);
     t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 0);
     C4::Circulation::AddIssue($patron->unblessed,
                               $item->barcode);
     t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 0);