Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 1; |
22 |
use Test::More tests => 2; |
23 |
|
23 |
|
24 |
use Koha::Items; |
24 |
use Koha::Items; |
25 |
use Koha::Database; |
25 |
use Koha::Database; |
Lines 61-63
subtest 'hidden_in_opac() tests' => sub {
Link Here
|
61 |
|
61 |
|
62 |
$schema->storage->txn_rollback; |
62 |
$schema->storage->txn_rollback; |
63 |
}; |
63 |
}; |
64 |
- |
64 |
|
|
|
65 |
subtest 'pending_hold() tests' => sub { |
66 |
|
67 |
plan tests => 3; |
68 |
|
69 |
$schema->storage->txn_begin; |
70 |
|
71 |
my $dbh = C4::Context->dbh; |
72 |
my $item = $builder->build_sample_item({ itemlost => 0 }); |
73 |
my $itemnumber = $item->itemnumber; |
74 |
|
75 |
# disable AllowItemsOnHoldCheckout as it ignores pending holds |
76 |
t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 ); |
77 |
$dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)"); |
78 |
ok( $item->pending_hold, "Yes, we have a pending hold"); |
79 |
t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 ); |
80 |
ok( !$item->pending_hold, "We don't consider a pending hold if hold items can be checked out"); |
81 |
t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 ); |
82 |
$dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber"); |
83 |
ok( !$item->pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue"); |
84 |
}; |