Lines 971-977
subtest 'store check barcodes' => sub {
Link Here
|
971 |
}; |
971 |
}; |
972 |
|
972 |
|
973 |
subtest 'deletion' => sub { |
973 |
subtest 'deletion' => sub { |
974 |
plan tests => 15; |
974 |
plan tests => 16; |
975 |
|
975 |
|
976 |
$schema->storage->txn_begin; |
976 |
$schema->storage->txn_begin; |
977 |
|
977 |
|
Lines 1147-1152
subtest 'deletion' => sub {
Link Here
|
1147 |
$schema->storage->txn_rollback; |
1147 |
$schema->storage->txn_rollback; |
1148 |
}; |
1148 |
}; |
1149 |
|
1149 |
|
|
|
1150 |
subtest 'serial issues tests' => sub { |
1151 |
plan tests => 4; |
1152 |
|
1153 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
1154 |
|
1155 |
$schema->storage->txn_begin; |
1156 |
|
1157 |
my $biblio = $builder->build_sample_biblio; |
1158 |
my $item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1159 |
my $serial = |
1160 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1161 |
my $serial_item = $builder->build_object( |
1162 |
{ |
1163 |
class => 'Koha::Serial::Items', |
1164 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1165 |
} |
1166 |
); |
1167 |
|
1168 |
# Check serial issue is not deleted unless argument passed |
1169 |
$item_with_serial->safe_delete( { delete_serial_issues => 0 } ); |
1170 |
|
1171 |
my $serial_check = Koha::Serials->find( $serial->serialid ); |
1172 |
my $serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1173 |
|
1174 |
is( $serial_check->serialid, $serial->serialid, 'Serial not deleted as the argument was not passed' ); |
1175 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1176 |
|
1177 |
$biblio = $builder->build_sample_biblio; |
1178 |
$item_with_serial = $builder->build_sample_item( { biblionumber => $biblio->id } ); |
1179 |
$serial = |
1180 |
$builder->build_object( { class => 'Koha::Serials', value => { biblionumber => $biblio->biblionumber } } ); |
1181 |
$serial_item = $builder->build_object( |
1182 |
{ |
1183 |
class => 'Koha::Serial::Items', |
1184 |
value => { itemnumber => $item_with_serial->itemnumber, serialid => $serial->serialid } |
1185 |
} |
1186 |
); |
1187 |
|
1188 |
# Check serial issue is deleted when argument passed |
1189 |
$item_with_serial->safe_delete( { delete_serial_issues => 1 } ); |
1190 |
|
1191 |
$serial_check = Koha::Serials->find( $serial->serialid ); |
1192 |
$serial_item_check = Koha::Serial::Items->find( $serial_item->itemnumber ); |
1193 |
|
1194 |
is( $serial_check, undef, 'Serial deleted' ); |
1195 |
is( $serial_item_check, undef, 'Serial item deleted by cascade' ); |
1196 |
|
1197 |
$schema->storage->txn_rollback; |
1198 |
}; |
1199 |
|
1150 |
$schema->storage->txn_rollback; |
1200 |
$schema->storage->txn_rollback; |
1151 |
}; |
1201 |
}; |
1152 |
|
1202 |
|
1153 |
- |
|
|