Lines 213-219
subtest 'bundle_host tests' => sub {
Link Here
|
213 |
}; |
213 |
}; |
214 |
|
214 |
|
215 |
subtest 'add_to_bundle tests' => sub { |
215 |
subtest 'add_to_bundle tests' => sub { |
216 |
plan tests => 7; |
216 |
plan tests => 13; |
217 |
|
217 |
|
218 |
$schema->storage->txn_begin; |
218 |
$schema->storage->txn_begin; |
219 |
|
219 |
|
Lines 227-232
subtest 'add_to_bundle tests' => sub {
Link Here
|
227 |
my $host_item = $builder->build_sample_item(); |
227 |
my $host_item = $builder->build_sample_item(); |
228 |
my $bundle_item1 = $builder->build_sample_item(); |
228 |
my $bundle_item1 = $builder->build_sample_item(); |
229 |
my $bundle_item2 = $builder->build_sample_item(); |
229 |
my $bundle_item2 = $builder->build_sample_item(); |
|
|
230 |
my $bundle_item3 = $builder->build_sample_item(); |
230 |
|
231 |
|
231 |
throws_ok { $host_item->add_to_bundle($host_item) } |
232 |
throws_ok { $host_item->add_to_bundle($host_item) } |
232 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
233 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
Lines 267-272
subtest 'add_to_bundle tests' => sub {
Link Here
|
267 |
$bundle_item2->discard_changes; |
268 |
$bundle_item2->discard_changes; |
268 |
ok( !$bundle_item2->checkout, 'Item is not checked out after being added to a bundle' ); |
269 |
ok( !$bundle_item2->checkout, 'Item is not checked out after being added to a bundle' ); |
269 |
|
270 |
|
|
|
271 |
$bundle_item3->itemlost(1)->store; |
272 |
throws_ok { $host_item->add_to_bundle($bundle_item3) } |
273 |
'Koha::Exceptions::Item::Bundle::ItemIsLost', |
274 |
'Exception thrown if you try to add a lost item to a bundle'; |
275 |
|
276 |
lives_ok { $host_item->add_to_bundle($bundle_item3, { mark_lost_item_as_found => 1 }) } |
277 |
'No exception thrown if you try to add a lost item to a bundle using "mark_lost_item_as_found"'; |
278 |
|
279 |
$bundle_item3->discard_changes; |
280 |
is($bundle_item3->itemlost, 0, 'Item is marked as found after being added to a bundle'); |
281 |
|
270 |
$schema->storage->txn_rollback; |
282 |
$schema->storage->txn_rollback; |
271 |
}; |
283 |
}; |
272 |
|
284 |
|
273 |
- |
|
|