|
Lines 917-923
subtest 'pickup_locations() tests' => sub {
Link Here
|
| 917 |
|
917 |
|
| 918 |
subtest 'edit() tests' => sub { |
918 |
subtest 'edit() tests' => sub { |
| 919 |
|
919 |
|
| 920 |
plan tests => 39; |
920 |
plan tests => 47; |
| 921 |
|
921 |
|
| 922 |
$schema->storage->txn_begin; |
922 |
$schema->storage->txn_begin; |
| 923 |
|
923 |
|
|
Lines 972-977
subtest 'edit() tests' => sub {
Link Here
|
| 972 |
branchcode => $library_3->branchcode, |
972 |
branchcode => $library_3->branchcode, |
| 973 |
itemnumber => undef, |
973 |
itemnumber => undef, |
| 974 |
priority => 1, |
974 |
priority => 1, |
|
|
975 |
reservedate => '2022-01-01', |
| 976 |
expirationdate => '2022-03-01' |
| 975 |
} |
977 |
} |
| 976 |
} |
978 |
} |
| 977 |
); |
979 |
); |
|
Lines 1026-1031
subtest 'edit() tests' => sub {
Link Here
|
| 1026 |
$biblio_hold->discard_changes; |
1028 |
$biblio_hold->discard_changes; |
| 1027 |
is( $biblio_hold->branchcode, $library_2->id, 'Pickup location changed correctly' ); |
1029 |
is( $biblio_hold->branchcode, $library_2->id, 'Pickup location changed correctly' ); |
| 1028 |
|
1030 |
|
|
|
1031 |
$biblio_hold_data = { |
| 1032 |
hold_date => '2022-01-02', |
| 1033 |
expiration_date => '2022-03-02' |
| 1034 |
}; |
| 1035 |
|
| 1036 |
$t->patch_ok( "//$userid:$password@/api/v1/holds/" |
| 1037 |
. $biblio_hold->id |
| 1038 |
=> json => $biblio_hold_data ) |
| 1039 |
->status_is(200); |
| 1040 |
|
| 1041 |
$biblio_hold->discard_changes; |
| 1042 |
is( $biblio_hold->reservedate, '2022-01-02', 'Hold date changed correctly' ); |
| 1043 |
is( $biblio_hold->expirationdate, '2022-03-02', 'Expiration date changed correctly' ); |
| 1044 |
|
| 1029 |
# Test item-level holds |
1045 |
# Test item-level holds |
| 1030 |
my $item_hold = $builder->build_object( |
1046 |
my $item_hold = $builder->build_object( |
| 1031 |
{ |
1047 |
{ |
|
Lines 1037-1042
subtest 'edit() tests' => sub {
Link Here
|
| 1037 |
priority => 1, |
1053 |
priority => 1, |
| 1038 |
suspend => 0, |
1054 |
suspend => 0, |
| 1039 |
suspend_until => undef, |
1055 |
suspend_until => undef, |
|
|
1056 |
reservedate => '2022-01-01', |
| 1057 |
expirationdate => '2022-03-01' |
| 1040 |
} |
1058 |
} |
| 1041 |
} |
1059 |
} |
| 1042 |
); |
1060 |
); |
|
Lines 1091-1096
subtest 'edit() tests' => sub {
Link Here
|
| 1091 |
is( $item_hold->suspend, 0, 'Location change should not activate suspended status' ); |
1109 |
is( $item_hold->suspend, 0, 'Location change should not activate suspended status' ); |
| 1092 |
is( $item_hold->suspend_until, undef, 'Location change should keep suspended_until be undef' ); |
1110 |
is( $item_hold->suspend_until, undef, 'Location change should keep suspended_until be undef' ); |
| 1093 |
|
1111 |
|
|
|
1112 |
$item_hold_data = { |
| 1113 |
hold_date => '2022-01-02', |
| 1114 |
expiration_date => '2022-03-02' |
| 1115 |
}; |
| 1116 |
|
| 1117 |
$t->patch_ok( "//$userid:$password@/api/v1/holds/" |
| 1118 |
. $item_hold->id |
| 1119 |
=> json => $item_hold_data ) |
| 1120 |
->status_is(200); |
| 1121 |
|
| 1122 |
$item_hold->discard_changes; |
| 1123 |
is( $item_hold->reservedate, '2022-01-02', 'Hold date changed correctly' ); |
| 1124 |
is( $item_hold->expirationdate, '2022-03-02', 'Expiration date changed correctly' ); |
| 1125 |
|
| 1094 |
$schema->storage->txn_rollback; |
1126 |
$schema->storage->txn_rollback; |
| 1095 |
|
1127 |
|
| 1096 |
}; |
1128 |
}; |
| 1097 |
- |
|
|