Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 10; |
22 |
use Test::More tests => 11; |
23 |
|
23 |
|
24 |
use Test::Exception; |
24 |
use Test::Exception; |
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
Lines 911-913
subtest 'can_update_pickup_location_opac() tests' => sub {
Link Here
|
911 |
|
911 |
|
912 |
$schema->storage->txn_rollback; |
912 |
$schema->storage->txn_rollback; |
913 |
}; |
913 |
}; |
914 |
- |
914 |
|
|
|
915 |
subtest 'change_type tests' => sub { |
916 |
|
917 |
plan tests => 9; |
918 |
|
919 |
$schema->storage->txn_begin; |
920 |
|
921 |
my $item = $builder->build_object( { class => 'Koha::Items', } ); |
922 |
my $hold = $builder->build_object( { |
923 |
class => 'Koha::Holds', |
924 |
value => { |
925 |
itemnumber => undef, |
926 |
} |
927 |
} ); |
928 |
|
929 |
my $hold2 = $builder->build_object( { |
930 |
class => 'Koha::Holds', |
931 |
value => { |
932 |
borrowernumber => $hold->borrowernumber, |
933 |
} |
934 |
} ); |
935 |
|
936 |
ok( $hold->change_type ); |
937 |
|
938 |
$hold->discard_changes; |
939 |
|
940 |
is( $hold->itemnumber, undef, 'record hold to record hold, no changes'); |
941 |
|
942 |
ok( $hold->change_type( $item->itemnumber ) ); |
943 |
|
944 |
$hold->discard_changes; |
945 |
|
946 |
is( $hold->itemnumber, $item->itemnumber, 'record hold to item hold'); |
947 |
|
948 |
ok( $hold->change_type( $item->itemnumber ) ); |
949 |
|
950 |
$hold->discard_changes; |
951 |
|
952 |
is( $hold->itemnumber, $item->itemnumber, 'item hold to item hold, no changes'); |
953 |
|
954 |
ok( $hold->change_type ); |
955 |
|
956 |
$hold->discard_changes; |
957 |
|
958 |
is( $hold->itemnumber, undef, 'item hold to record hold'); |
959 |
|
960 |
my $hold3 = $builder->build_object( { |
961 |
class => 'Koha::Holds', |
962 |
value => { |
963 |
biblionumber => $hold->biblionumber, |
964 |
borrowernumber => $hold->borrowernumber, |
965 |
} |
966 |
} ); |
967 |
|
968 |
throws_ok { $hold->change_type } |
969 |
'Koha::Exceptions::Hold::CannotChangeHoldType', |
970 |
'Exception thrown because more than one hold per record'; |
971 |
|
972 |
$schema->storage->txn_rollback; |
973 |
}; |