Bug 17599: Make the tests pass
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 15 Nov 2016 15:49:00 +0000 (15:49 +0000)
committerKoha instance kohadev-koha <kohadev-koha@kohadevbox>
Tue, 15 Nov 2016 15:54:24 +0000 (15:54 +0000)
If you run TooMany or MultiplePerRecord.t after
t/db_dependent/Circulation/Returns.t (for instance) and that you are
running memcached, item-level_itypes will be 0.
These tests assume that the pref is 1

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Circulation/TooMany.t
t/db_dependent/Reserves/MultiplePerRecord.t

index d066809..0e129c3 100644 (file)
@@ -50,6 +50,7 @@ $dbh->do(q|DELETE FROM default_branch_item_rules|);
 $dbh->do(q|DELETE FROM issuingrules|);
 
 my $builder = t::lib::TestBuilder->new();
+t::lib::Mocks::mock_preference('item-level_itypes', 1); # Assuming the item type is defined at item level
 
 my $branch = $builder->build({
     source => 'Branch',
index d2da653..559cef4 100755 (executable)
@@ -21,6 +21,7 @@ use Modern::Perl;
 
 use Test::More tests => 38;
 use t::lib::TestBuilder;
+use t::lib::Mocks;
 
 use C4::Reserves qw( GetMaxPatronHoldsForRecord AddReserve CanBookBeReserved );
 use Koha::Database;
@@ -119,6 +120,8 @@ my $rule1 = $rules_rs->new(
     }
 )->insert();
 
+t::lib::Mocks::mock_preference('item-level_itypes', 1); # Assuming the item type is defined at item level
+
 my $max = GetMaxPatronHoldsForRecord( $patron->{borrowernumber}, $biblio->{biblionumber} );
 is( $max, 1, 'GetMaxPatronHoldsForRecord returns max of 1' );
 my $rule = C4::Reserves::GetHoldRule(