Lines 796-803
subtest 'get_transfers' => sub {
Link Here
|
796 |
$schema->storage->txn_rollback; |
796 |
$schema->storage->txn_rollback; |
797 |
}; |
797 |
}; |
798 |
|
798 |
|
799 |
subtest 'move_to_biblio() tests' => sub { |
799 |
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { |
|
|
800 |
plan tests => 2; |
801 |
|
802 |
my $biblio = $builder->build_sample_biblio(); |
803 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
804 |
my $aq_budget = $builder->build({ |
805 |
source => 'Aqbudget', |
806 |
value => { |
807 |
budget_notes => 'test', |
808 |
}, |
809 |
}); |
810 |
|
811 |
my $order_note = 'Order for ' . $item->itemnumber; |
812 |
|
813 |
my $aq_order1 = $builder->build_object({ |
814 |
class => 'Koha::Acquisition::Orders', |
815 |
value => { |
816 |
biblionumber => $biblio->biblionumber, |
817 |
budget_id => $aq_budget->{budget_id}, |
818 |
order_internalnote => $order_note, |
819 |
}, |
820 |
}); |
821 |
my $aq_order2 = $builder->build_object({ |
822 |
class => 'Koha::Acquisition::Orders', |
823 |
value => { |
824 |
biblionumber => $biblio->biblionumber, |
825 |
budget_id => $aq_budget->{budget_id}, |
826 |
}, |
827 |
}); |
828 |
my $aq_order_item1 = $builder->build({ |
829 |
source => 'AqordersItem', |
830 |
value => { |
831 |
ordernumber => $aq_order1->ordernumber, |
832 |
itemnumber => $item->itemnumber, |
833 |
}, |
834 |
}); |
835 |
|
836 |
my $orders = $item->item_orders; |
837 |
is ($orders->count, 1, 'One order found by item with the relationship'); |
838 |
is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); |
839 |
}; |
800 |
|
840 |
|
|
|
841 |
subtest 'move_to_biblio() tests' => sub { |
801 |
plan tests => 16; |
842 |
plan tests => 16; |
802 |
|
843 |
|
803 |
$schema->storage->txn_begin; |
844 |
$schema->storage->txn_begin; |