Lines 934-944
subtest 'prefetch_whitelist() tests' => sub {
Link Here
|
934 |
|
934 |
|
935 |
subtest 'set_or_blank' => sub { |
935 |
subtest 'set_or_blank' => sub { |
936 |
|
936 |
|
937 |
plan tests => 5; |
937 |
plan tests => 7; |
938 |
|
938 |
|
939 |
$schema->storage->txn_begin; |
939 |
$schema->storage->txn_begin; |
940 |
|
940 |
|
941 |
my $item = $builder->build_sample_item; |
941 |
my $item = $builder->build_sample_item({ onloan => '2021-01-01'}); |
942 |
my $item_info = $item->unblessed; |
942 |
my $item_info = $item->unblessed; |
943 |
$item = $item->set_or_blank($item_info); |
943 |
$item = $item->set_or_blank($item_info); |
944 |
is_deeply($item->unblessed, $item_info, 'set_or_blank assign the correct value if unchanged'); |
944 |
is_deeply($item->unblessed, $item_info, 'set_or_blank assign the correct value if unchanged'); |
Lines 963-968
subtest 'set_or_blank' => sub {
Link Here
|
963 |
$item = $item->set_or_blank($item_info); |
963 |
$item = $item->set_or_blank($item_info); |
964 |
isnt($item->timestamp, undef, 'set_or_blank should have set timestamp to a correct value'); |
964 |
isnt($item->timestamp, undef, 'set_or_blank should have set timestamp to a correct value'); |
965 |
|
965 |
|
|
|
966 |
# timestamp not null |
967 |
delete $item_info->{onloan}; |
968 |
$item = $item->set_or_blank($item_info); |
969 |
is($item->onloan, '2021-01-01', 'set_or_blank should retain original onloan if none passed'); |
970 |
|
971 |
# timestamp not null |
972 |
$item_info->{onloan} = '2020-01-01'; |
973 |
$item = $item->set_or_blank($item_info); |
974 |
is($item->onloan, '2020-01-01', 'set_or_blank should set onloan if passed'); |
975 |
|
966 |
$schema->storage->txn_rollback; |
976 |
$schema->storage->txn_rollback; |
967 |
}; |
977 |
}; |
968 |
|
978 |
|
969 |
- |
|
|