Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 9; |
22 |
use Test::More tests => 10; |
23 |
|
23 |
|
24 |
use Test::Exception; |
24 |
use Test::Exception; |
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
Lines 29-34
use t::lib::TestBuilder;
Link Here
|
29 |
use t::lib::Mocks; |
29 |
use t::lib::Mocks; |
30 |
|
30 |
|
31 |
use Koha::ActionLogs; |
31 |
use Koha::ActionLogs; |
|
|
32 |
use Koha::DateUtils qw(dt_from_string); |
32 |
use Koha::Holds; |
33 |
use Koha::Holds; |
33 |
use Koha::Libraries; |
34 |
use Koha::Libraries; |
34 |
use Koha::Old::Holds; |
35 |
use Koha::Old::Holds; |
Lines 863-865
subtest 'cancellation_requestable_from_opac() tests' => sub {
Link Here
|
863 |
|
864 |
|
864 |
$schema->storage->txn_rollback; |
865 |
$schema->storage->txn_rollback; |
865 |
}; |
866 |
}; |
866 |
- |
867 |
|
|
|
868 |
subtest 'can_update_pickup_location_opac() tests' => sub { |
869 |
|
870 |
plan tests => 8; |
871 |
|
872 |
$schema->storage->txn_begin; |
873 |
|
874 |
my $hold = $builder->build_object( |
875 |
{ class => 'Koha::Holds', |
876 |
value => { found => undef, suspend => 0, suspend_until => undef, waitingdate => undef } |
877 |
} |
878 |
); |
879 |
|
880 |
t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', '' ); |
881 |
$hold->found(undef); |
882 |
is( $hold->can_update_pickup_location_opac, 0, "Pending hold pickup can't be changed (No change allowed)" ); |
883 |
|
884 |
$hold->found('T'); |
885 |
is( $hold->can_update_pickup_location_opac, 0, "In transit hold pickup can't be changed (No change allowed)" ); |
886 |
|
887 |
$hold->found('W'); |
888 |
is( $hold->can_update_pickup_location_opac, 0, "Waiting hold pickup can't be changed (No change allowed)" ); |
889 |
|
890 |
$hold->found(undef); |
891 |
my $dt = dt_from_string(); |
892 |
|
893 |
$hold->suspend_hold( $dt ); |
894 |
is( $hold->can_update_pickup_location_opac, 0, "Suspended hold pickup can't be changed (No change allowed)" ); |
895 |
$hold->resume(); |
896 |
|
897 |
t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', 'pending,intransit,suspended' ); |
898 |
$hold->found(undef); |
899 |
is( $hold->can_update_pickup_location_opac, 1, "Pending hold pickup can be changed (pending,intransit,suspended allowed)" ); |
900 |
|
901 |
$hold->found('T'); |
902 |
is( $hold->can_update_pickup_location_opac, 1, "In transit hold pickup can be changed (pending,intransit,suspended allowed)" ); |
903 |
|
904 |
$hold->found('W'); |
905 |
is( $hold->can_update_pickup_location_opac, 0, "Waiting hold pickup can't be changed (pending,intransit,suspended allowed)" ); |
906 |
|
907 |
$hold->found(undef); |
908 |
$dt = dt_from_string(); |
909 |
$hold->suspend_hold( $dt ); |
910 |
is( $hold->can_update_pickup_location_opac, 1, "Suspended hold pickup can be changed (pending,intransit,suspended allowed)" ); |
911 |
|
912 |
$schema->storage->txn_rollback; |
913 |
}; |