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 => 10; |
216 |
plan tests => 11; |
217 |
|
217 |
|
218 |
$schema->storage->txn_begin; |
218 |
$schema->storage->txn_begin; |
219 |
|
219 |
|
Lines 227-237
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(); |
231 |
|
232 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
230 |
|
233 |
|
231 |
throws_ok { $host_item->add_to_bundle($host_item) } |
234 |
throws_ok { $host_item->add_to_bundle($host_item) } |
232 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
235 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
233 |
'Exception thrown if you try to add the item to itself'; |
236 |
'Exception thrown if you try to add the item to itself'; |
234 |
|
237 |
|
|
|
238 |
my $reserve_id = C4::Reserves::AddReserve( |
239 |
{ |
240 |
branchcode => $library->branchcode, |
241 |
borrowernumber => $patron->borrowernumber, |
242 |
biblionumber => $bundle_item3->biblionumber, |
243 |
itemnumber => $bundle_item3->itemnumber, |
244 |
} |
245 |
); |
246 |
throws_ok { $host_item->add_to_bundle($bundle_item3) } |
247 |
'Koha::Exceptions::Item::Bundle::ItemHasHolds', |
248 |
'Exception thrown if you try to add an item with holds to a bundle'; |
249 |
|
235 |
ok($host_item->add_to_bundle($bundle_item1), 'bundle_item1 added to bundle'); |
250 |
ok($host_item->add_to_bundle($bundle_item1), 'bundle_item1 added to bundle'); |
236 |
is($bundle_item1->notforloan, 1, 'add_to_bundle sets notforloan to BundleNotLoanValue'); |
251 |
is($bundle_item1->notforloan, 1, 'add_to_bundle sets notforloan to BundleNotLoanValue'); |
237 |
|
252 |
|
Lines 247-253
subtest 'add_to_bundle tests' => sub {
Link Here
|
247 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
262 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
248 |
'Exception thrown if you try to add a bundle host to a bundle item'; |
263 |
'Exception thrown if you try to add a bundle host to a bundle item'; |
249 |
|
264 |
|
250 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
|
251 |
C4::Circulation::AddIssue( $patron->unblessed, $bundle_item2->barcode ); |
265 |
C4::Circulation::AddIssue( $patron->unblessed, $bundle_item2->barcode ); |
252 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
266 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
253 |
'Koha::Exceptions::Item::Bundle::ItemIsCheckedOut', |
267 |
'Koha::Exceptions::Item::Bundle::ItemIsCheckedOut', |
254 |
- |
|
|