Lines 29-35
use Koha::Item;
Link Here
|
29 |
use Koha::DateUtils qw( dt_from_string ); |
29 |
use Koha::DateUtils qw( dt_from_string ); |
30 |
use t::lib::TestBuilder; |
30 |
use t::lib::TestBuilder; |
31 |
|
31 |
|
32 |
use Test::More tests => 34; |
32 |
use Test::More tests => 42; |
33 |
use Test::Exception; |
33 |
use Test::Exception; |
34 |
use Test::Warn; |
34 |
use Test::Warn; |
35 |
|
35 |
|
Lines 142-147
ok( !$hold->is_at_destination(), "Waiting hold where hold branchcode is not the
Link Here
|
142 |
$item->holdingbranch( $branches[1]->{branchcode} ); |
142 |
$item->holdingbranch( $branches[1]->{branchcode} ); |
143 |
ok( $hold->is_at_destination(), "Waiting hold where hold branchcode is the same as the item's holdingbranch is at destination" ); |
143 |
ok( $hold->is_at_destination(), "Waiting hold where hold branchcode is the same as the item's holdingbranch is at destination" ); |
144 |
|
144 |
|
|
|
145 |
#Test method can_change_branch_opac |
146 |
t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', '' ); |
147 |
$hold->found(undef); |
148 |
is( $hold->can_change_branch_opac, 0, "Pending hold pickup can't be changed (No change allowed)" ); |
149 |
$hold->found('T'); |
150 |
is( $hold->can_change_branch_opac, 0, "In transit hold pickup can't be changed (No change allowed)" ); |
151 |
$hold->found('W'); |
152 |
is( $hold->can_change_branch_opac, 0, "Waiting hold pickup can't be changed (No change allowed)" ); |
153 |
$hold->found(undef); |
154 |
my $dt = dt_from_string(); |
155 |
$hold->suspend_hold( $dt ); |
156 |
is( $hold->can_change_branch_opac, 0, "Suspended hold pickup can't be changed (No change allowed)" ); |
157 |
$hold->resume(); |
158 |
t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', 'pending,intransit,suspended' ); |
159 |
$hold->found(undef); |
160 |
is( $hold->can_change_branch_opac, 1, "Pending hold pickup can be changed (pending,intransit,suspended allowed)" ); |
161 |
$hold->found('T'); |
162 |
is( $hold->can_change_branch_opac, 1, "In transit hold pickup can be changed (pending,intransit,suspended allowed)" ); |
163 |
$hold->found('W'); |
164 |
is( $hold->can_change_branch_opac, 0, "Waiting hold pickup can't be changed (pending,intransit,suspended allowed)" ); |
165 |
$hold->found(undef); |
166 |
my $dt = dt_from_string(); |
167 |
$hold->suspend_hold( $dt ); |
168 |
is( $hold->can_change_branch_opac, 1, "Suspended hold pickup can be changed (pending,intransit,suspended allowed)" ); |
169 |
$hold->resume(); |
170 |
|
145 |
$schema->storage->txn_rollback(); |
171 |
$schema->storage->txn_rollback(); |
146 |
|
172 |
|
147 |
subtest "store() tests" => sub { |
173 |
subtest "store() tests" => sub { |
148 |
- |
|
|