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