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