Lines 844-850
subtest 'request_transfer' => sub {
Link Here
|
844 |
}; |
844 |
}; |
845 |
|
845 |
|
846 |
subtest 'deletion' => sub { |
846 |
subtest 'deletion' => sub { |
847 |
plan tests => 15; |
847 |
plan tests => 16; |
848 |
|
848 |
|
849 |
$schema->storage->txn_begin; |
849 |
$schema->storage->txn_begin; |
850 |
|
850 |
|
Lines 1020-1025
subtest 'deletion' => sub {
Link Here
|
1020 |
$schema->storage->txn_rollback; |
1020 |
$schema->storage->txn_rollback; |
1021 |
}; |
1021 |
}; |
1022 |
|
1022 |
|
|
|
1023 |
subtest 'serial issues tests' => sub { |
1024 |
plan tests => 4; |
1025 |
|
1026 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
1027 |
|
1028 |
$schema->storage->txn_begin; |
1029 |
|
1030 |
my $biblio = $builder->build_sample_biblio; |
1031 |
my $item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1032 |
my $serial = |
1033 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1034 |
my $serial_item = $builder->build_object( |
1035 |
{ |
1036 |
class => 'Koha::Serial::Items', |
1037 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1038 |
} |
1039 |
); |
1040 |
|
1041 |
# Check serial issue is not deleted unless argument passed |
1042 |
$item_with_serial->safe_delete( { delete_serial_issues => 0 } ); |
1043 |
|
1044 |
my $serial_check = Koha::Serials->find( $serial->serialid ); |
1045 |
my $serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1046 |
|
1047 |
is( $serial_check->serialid, $serial->serialid, 'Serial not deleted as the argument was not passed' ); |
1048 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1049 |
|
1050 |
$biblio = $builder->build_sample_biblio; |
1051 |
$item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1052 |
$serial = |
1053 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1054 |
$serial_item = $builder->build_object( |
1055 |
{ |
1056 |
class => 'Koha::Serial::Items', |
1057 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1058 |
} |
1059 |
); |
1060 |
|
1061 |
# Check serial issue is deleted when argument passed |
1062 |
$item_with_serial->safe_delete( { delete_serial_issues => 1 } ); |
1063 |
|
1064 |
$serial_check = Koha::Serials->find( $serial->serialid ); |
1065 |
$serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1066 |
|
1067 |
is( $serial_check, undef, 'Serial deleted' ); |
1068 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1069 |
|
1070 |
$schema->storage->txn_rollback; |
1071 |
}; |
1072 |
|
1023 |
$schema->storage->txn_rollback; |
1073 |
$schema->storage->txn_rollback; |
1024 |
}; |
1074 |
}; |
1025 |
|
1075 |
|
1026 |
- |
|
|