|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
| 23 |
|
23 |
|
| 24 |
use C4::Biblio; |
24 |
use C4::Biblio; |
| 25 |
use C4::Circulation; |
25 |
use C4::Circulation; |
|
Lines 517-524
subtest 'Tests for itemtype' => sub {
Link Here
|
| 517 |
$schema->storage->txn_rollback; |
517 |
$schema->storage->txn_rollback; |
| 518 |
}; |
518 |
}; |
| 519 |
|
519 |
|
| 520 |
subtest 'move_to_biblio() tests' => sub { |
520 |
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { |
|
|
521 |
plan tests => 2; |
| 522 |
|
| 523 |
my $biblio = $builder->build_sample_biblio(); |
| 524 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
| 525 |
my $aq_budget = $builder->build({ |
| 526 |
source => 'Aqbudget', |
| 527 |
value => { |
| 528 |
budget_notes => 'test', |
| 529 |
}, |
| 530 |
}); |
| 531 |
|
| 532 |
my $order_note = 'Order for ' . $item->itemnumber; |
| 533 |
|
| 534 |
my $aq_order1 = $builder->build_object({ |
| 535 |
class => 'Koha::Acquisition::Orders', |
| 536 |
value => { |
| 537 |
biblionumber => $biblio->biblionumber, |
| 538 |
budget_id => $aq_budget->{budget_id}, |
| 539 |
order_internalnote => $order_note, |
| 540 |
}, |
| 541 |
}); |
| 542 |
my $aq_order2 = $builder->build_object({ |
| 543 |
class => 'Koha::Acquisition::Orders', |
| 544 |
value => { |
| 545 |
biblionumber => $biblio->biblionumber, |
| 546 |
budget_id => $aq_budget->{budget_id}, |
| 547 |
}, |
| 548 |
}); |
| 549 |
my $aq_order_item1 = $builder->build({ |
| 550 |
source => 'AqordersItem', |
| 551 |
value => { |
| 552 |
ordernumber => $aq_order1->ordernumber, |
| 553 |
itemnumber => $item->itemnumber, |
| 554 |
}, |
| 555 |
}); |
| 556 |
|
| 557 |
my $orders = $item->item_orders; |
| 558 |
is ($orders->count, 1, 'One order found by item with the relationship'); |
| 559 |
is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); |
| 560 |
}; |
| 521 |
|
561 |
|
|
|
562 |
subtest 'move_to_biblio() tests' => sub { |
| 522 |
plan tests => 16; |
563 |
plan tests => 16; |
| 523 |
|
564 |
|
| 524 |
$schema->storage->txn_begin; |
565 |
$schema->storage->txn_begin; |