subtest 'GetItemsInfo tests' => sub {
- plan tests => 7;
+ plan tests => 9;
$schema->storage->txn_begin;
is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
'GetItemsInfo returns a restricted value description (OPAC)' );
+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
+ #place item into holds queue
+ my $dbh = C4::Context->dbh;
+ $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
+ @results = GetItemsInfo( $biblio->biblionumber );
+ is( $results[0]->{ pending_hold }, "1",
+ 'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
+ @results = GetItemsInfo( $biblio->biblionumber );
+ is( $results[0]->{ pending_hold }, undef,
+ 'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
+
+
$schema->storage->txn_rollback;
};