Lines 692-699
subtest 'Tests for itemtype' => sub {
Link Here
|
692 |
$schema->storage->txn_rollback; |
692 |
$schema->storage->txn_rollback; |
693 |
}; |
693 |
}; |
694 |
|
694 |
|
695 |
subtest 'move_to_biblio() tests' => sub { |
695 |
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { |
|
|
696 |
plan tests => 2; |
697 |
|
698 |
my $biblio = $builder->build_sample_biblio(); |
699 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
700 |
my $aq_budget = $builder->build({ |
701 |
source => 'Aqbudget', |
702 |
value => { |
703 |
budget_notes => 'test', |
704 |
}, |
705 |
}); |
706 |
|
707 |
my $order_note = 'Order for ' . $item->itemnumber; |
708 |
|
709 |
my $aq_order1 = $builder->build_object({ |
710 |
class => 'Koha::Acquisition::Orders', |
711 |
value => { |
712 |
biblionumber => $biblio->biblionumber, |
713 |
budget_id => $aq_budget->{budget_id}, |
714 |
order_internalnote => $order_note, |
715 |
}, |
716 |
}); |
717 |
my $aq_order2 = $builder->build_object({ |
718 |
class => 'Koha::Acquisition::Orders', |
719 |
value => { |
720 |
biblionumber => $biblio->biblionumber, |
721 |
budget_id => $aq_budget->{budget_id}, |
722 |
}, |
723 |
}); |
724 |
my $aq_order_item1 = $builder->build({ |
725 |
source => 'AqordersItem', |
726 |
value => { |
727 |
ordernumber => $aq_order1->ordernumber, |
728 |
itemnumber => $item->itemnumber, |
729 |
}, |
730 |
}); |
731 |
|
732 |
my $orders = $item->item_orders; |
733 |
is ($orders->count, 1, 'One order found by item with the relationship'); |
734 |
is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); |
735 |
}; |
696 |
|
736 |
|
|
|
737 |
subtest 'move_to_biblio() tests' => sub { |
697 |
plan tests => 16; |
738 |
plan tests => 16; |
698 |
|
739 |
|
699 |
$schema->storage->txn_begin; |
740 |
$schema->storage->txn_begin; |