Lines 211-217
subtest 'bundle_host tests' => sub {
Link Here
|
211 |
}; |
211 |
}; |
212 |
|
212 |
|
213 |
subtest 'add_to_bundle tests' => sub { |
213 |
subtest 'add_to_bundle tests' => sub { |
214 |
plan tests => 3; |
214 |
plan tests => 6; |
215 |
|
215 |
|
216 |
$schema->storage->txn_begin; |
216 |
$schema->storage->txn_begin; |
217 |
|
217 |
|
Lines 221-226
subtest 'add_to_bundle tests' => sub {
Link Here
|
221 |
my $bundle_item1 = $builder->build_sample_item(); |
221 |
my $bundle_item1 = $builder->build_sample_item(); |
222 |
my $bundle_item2 = $builder->build_sample_item(); |
222 |
my $bundle_item2 = $builder->build_sample_item(); |
223 |
|
223 |
|
|
|
224 |
throws_ok { $host_item->add_to_bundle($host_item) } |
225 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
226 |
'Exception thrown if you try to add the item to itself'; |
227 |
|
224 |
ok($host_item->add_to_bundle($bundle_item1), 'bundle_item1 added to bundle'); |
228 |
ok($host_item->add_to_bundle($bundle_item1), 'bundle_item1 added to bundle'); |
225 |
is($bundle_item1->notforloan, 1, 'add_to_bundle sets notforloan to BundleNotLoanValue'); |
229 |
is($bundle_item1->notforloan, 1, 'add_to_bundle sets notforloan to BundleNotLoanValue'); |
226 |
|
230 |
|
Lines 228-233
subtest 'add_to_bundle tests' => sub {
Link Here
|
228 |
'Koha::Exceptions::Object::DuplicateID', |
232 |
'Koha::Exceptions::Object::DuplicateID', |
229 |
'Exception thrown if you try to add the same item twice'; |
233 |
'Exception thrown if you try to add the same item twice'; |
230 |
|
234 |
|
|
|
235 |
throws_ok { $bundle_item1->add_to_bundle($bundle_item2) } |
236 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
237 |
'Exception thrown if you try to add an item to a bundled item'; |
238 |
|
239 |
throws_ok { $bundle_item2->add_to_bundle($host_item) } |
240 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
241 |
'Exception thrown if you try to add a bundle host to a bundle item'; |
242 |
|
231 |
$schema->storage->txn_rollback; |
243 |
$schema->storage->txn_rollback; |
232 |
}; |
244 |
}; |
233 |
|
245 |
|
234 |
- |
|
|