|
Lines 817-824
subtest 'get_transfers' => sub {
Link Here
|
| 817 |
$schema->storage->txn_rollback; |
817 |
$schema->storage->txn_rollback; |
| 818 |
}; |
818 |
}; |
| 819 |
|
819 |
|
| 820 |
subtest 'move_to_biblio() tests' => sub { |
820 |
subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { |
|
|
821 |
plan tests => 2; |
| 822 |
|
| 823 |
my $biblio = $builder->build_sample_biblio(); |
| 824 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
| 825 |
my $aq_budget = $builder->build({ |
| 826 |
source => 'Aqbudget', |
| 827 |
value => { |
| 828 |
budget_notes => 'test', |
| 829 |
}, |
| 830 |
}); |
| 831 |
|
| 832 |
my $order_note = 'Order for ' . $item->itemnumber; |
| 833 |
|
| 834 |
my $aq_order1 = $builder->build_object({ |
| 835 |
class => 'Koha::Acquisition::Orders', |
| 836 |
value => { |
| 837 |
biblionumber => $biblio->biblionumber, |
| 838 |
budget_id => $aq_budget->{budget_id}, |
| 839 |
order_internalnote => $order_note, |
| 840 |
}, |
| 841 |
}); |
| 842 |
my $aq_order2 = $builder->build_object({ |
| 843 |
class => 'Koha::Acquisition::Orders', |
| 844 |
value => { |
| 845 |
biblionumber => $biblio->biblionumber, |
| 846 |
budget_id => $aq_budget->{budget_id}, |
| 847 |
}, |
| 848 |
}); |
| 849 |
my $aq_order_item1 = $builder->build({ |
| 850 |
source => 'AqordersItem', |
| 851 |
value => { |
| 852 |
ordernumber => $aq_order1->ordernumber, |
| 853 |
itemnumber => $item->itemnumber, |
| 854 |
}, |
| 855 |
}); |
| 856 |
|
| 857 |
my $orders = $item->item_orders; |
| 858 |
is ($orders->count, 1, 'One order found by item with the relationship'); |
| 859 |
is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); |
| 860 |
}; |
| 821 |
|
861 |
|
|
|
862 |
subtest 'move_to_biblio() tests' => sub { |
| 822 |
plan tests => 16; |
863 |
plan tests => 16; |
| 823 |
|
864 |
|
| 824 |
$schema->storage->txn_begin; |
865 |
$schema->storage->txn_begin; |