|
Lines 285-291
subtest 'duplicate_to | add_item' => sub {
Link Here
|
| 285 |
|
285 |
|
| 286 |
subtest 'current_item_level_holds() tests' => sub { |
286 |
subtest 'current_item_level_holds() tests' => sub { |
| 287 |
|
287 |
|
| 288 |
plan tests => 3; |
288 |
plan tests => 5; |
| 289 |
|
289 |
|
| 290 |
$schema->storage->txn_begin; |
290 |
$schema->storage->txn_begin; |
| 291 |
|
291 |
|
|
Lines 334-349
subtest 'current_item_level_holds() tests' => sub {
Link Here
|
| 334 |
} |
334 |
} |
| 335 |
); |
335 |
); |
| 336 |
|
336 |
|
| 337 |
is( $order->current_item_level_holds, undef, 'Returns undef if no linked biblio'); |
337 |
my $holds = $order->current_item_level_holds; |
|
|
338 |
|
| 339 |
is( ref($holds), 'Koha::Holds', 'Koha::Holds iterator returned if no linked biblio' ); |
| 340 |
is( $holds->count, 0, 'Count is 0 if no linked biblio' ); |
| 338 |
|
341 |
|
| 339 |
$order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes; |
342 |
$order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes; |
| 340 |
|
343 |
|
| 341 |
is( $order->current_item_level_holds, undef, 'Returns undef if no linked items'); |
344 |
$holds = $order->current_item_level_holds; |
|
|
345 |
|
| 346 |
is( ref($holds), 'Koha::Holds', 'Koha::Holds iterator returned if no linked items' ); |
| 347 |
is( $holds->count, 0, 'Count is 0 if no linked items' ); |
| 342 |
|
348 |
|
| 343 |
$order->add_item( $item_2->itemnumber ); |
349 |
$order->add_item( $item_2->itemnumber ); |
| 344 |
$order->add_item( $item_3->itemnumber ); |
350 |
$order->add_item( $item_3->itemnumber ); |
| 345 |
|
351 |
|
| 346 |
is( $order->current_item_level_holds->count, 1, 'Only current (not future) holds are returned'); |
352 |
$holds = $order->current_item_level_holds; |
|
|
353 |
is( $holds->count, 1, 'Only current (not future) holds are returned'); |
| 347 |
|
354 |
|
| 348 |
$schema->storage->txn_rollback; |
355 |
$schema->storage->txn_rollback; |
| 349 |
}; |
356 |
}; |
| 350 |
- |
|
|