Lines 955-961
subtest 'store check barcodes' => sub {
Link Here
|
955 |
}; |
955 |
}; |
956 |
|
956 |
|
957 |
subtest 'deletion' => sub { |
957 |
subtest 'deletion' => sub { |
958 |
plan tests => 15; |
958 |
plan tests => 16; |
959 |
|
959 |
|
960 |
$schema->storage->txn_begin; |
960 |
$schema->storage->txn_begin; |
961 |
|
961 |
|
Lines 1131-1136
subtest 'deletion' => sub {
Link Here
|
1131 |
$schema->storage->txn_rollback; |
1131 |
$schema->storage->txn_rollback; |
1132 |
}; |
1132 |
}; |
1133 |
|
1133 |
|
|
|
1134 |
subtest 'serial issues tests' => sub { |
1135 |
plan tests => 4; |
1136 |
|
1137 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
1138 |
|
1139 |
$schema->storage->txn_begin; |
1140 |
|
1141 |
my $biblio = $builder->build_sample_biblio; |
1142 |
my $item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1143 |
my $serial = |
1144 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1145 |
my $serial_item = $builder->build_object( |
1146 |
{ |
1147 |
class => 'Koha::Serial::Items', |
1148 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1149 |
} |
1150 |
); |
1151 |
|
1152 |
# Check serial issue is not deleted unless argument passed |
1153 |
$item_with_serial->safe_delete( { delete_serial_issues => 0 } ); |
1154 |
|
1155 |
my $serial_check = Koha::Serials->find( $serial->serialid ); |
1156 |
my $serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1157 |
|
1158 |
is( $serial_check->serialid, $serial->serialid, 'Serial not deleted as the argument was not passed' ); |
1159 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1160 |
|
1161 |
$biblio = $builder->build_sample_biblio; |
1162 |
$item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1163 |
$serial = |
1164 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1165 |
$serial_item = $builder->build_object( |
1166 |
{ |
1167 |
class => 'Koha::Serial::Items', |
1168 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1169 |
} |
1170 |
); |
1171 |
|
1172 |
# Check serial issue is deleted when argument passed |
1173 |
$item_with_serial->safe_delete( { delete_serial_issues => 1 } ); |
1174 |
|
1175 |
$serial_check = Koha::Serials->find( $serial->serialid ); |
1176 |
$serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1177 |
|
1178 |
is( $serial_check, undef, 'Serial deleted' ); |
1179 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1180 |
|
1181 |
$schema->storage->txn_rollback; |
1182 |
}; |
1183 |
|
1134 |
$schema->storage->txn_rollback; |
1184 |
$schema->storage->txn_rollback; |
1135 |
}; |
1185 |
}; |
1136 |
|
1186 |
|
1137 |
- |
|
|