|
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 629-636
subtest 'Tests for itemtype' => sub {
Link Here
|
| 629 |
$schema->storage->txn_rollback; |
629 |
$schema->storage->txn_rollback; |
| 630 |
}; |
630 |
}; |
| 631 |
|
631 |
|
| 632 |
subtest 'move_to_biblio() tests' => sub { |
632 |
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { |
|
|
633 |
plan tests => 2; |
| 634 |
|
| 635 |
my $biblio = $builder->build_sample_biblio(); |
| 636 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
| 637 |
my $aq_budget = $builder->build({ |
| 638 |
source => 'Aqbudget', |
| 639 |
value => { |
| 640 |
budget_notes => 'test', |
| 641 |
}, |
| 642 |
}); |
| 643 |
|
| 644 |
my $order_note = 'Order for ' . $item->itemnumber; |
| 645 |
|
| 646 |
my $aq_order1 = $builder->build_object({ |
| 647 |
class => 'Koha::Acquisition::Orders', |
| 648 |
value => { |
| 649 |
biblionumber => $biblio->biblionumber, |
| 650 |
budget_id => $aq_budget->{budget_id}, |
| 651 |
order_internalnote => $order_note, |
| 652 |
}, |
| 653 |
}); |
| 654 |
my $aq_order2 = $builder->build_object({ |
| 655 |
class => 'Koha::Acquisition::Orders', |
| 656 |
value => { |
| 657 |
biblionumber => $biblio->biblionumber, |
| 658 |
budget_id => $aq_budget->{budget_id}, |
| 659 |
}, |
| 660 |
}); |
| 661 |
my $aq_order_item1 = $builder->build({ |
| 662 |
source => 'AqordersItem', |
| 663 |
value => { |
| 664 |
ordernumber => $aq_order1->ordernumber, |
| 665 |
itemnumber => $item->itemnumber, |
| 666 |
}, |
| 667 |
}); |
| 668 |
|
| 669 |
my $orders = $item->item_orders; |
| 670 |
is ($orders->count, 1, 'One order found by item with the relationship'); |
| 671 |
is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); |
| 672 |
}; |
| 633 |
|
673 |
|
|
|
674 |
subtest 'move_to_biblio() tests' => sub { |
| 634 |
plan tests => 16; |
675 |
plan tests => 16; |
| 635 |
|
676 |
|
| 636 |
$schema->storage->txn_begin; |
677 |
$schema->storage->txn_begin; |