From 07a3cf32c5ca7dd3ac62dce1fa83f70fa223c8f7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 1 Apr 2016 09:24:04 +0200 Subject: [PATCH] Bug 16170: [QA Follow-up] Adjust Items.t Items.t inserts an item via biblioitem not correctly linked to biblio. The new foreign key constraint does not allow that. Actually, we should be choosing to either remove biblioitems from Koha or remove biblionumber from items. Note: This seems to be the only case where an item is added this way. Test plan: Run Items.t Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- t/db_dependent/Items.t | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index 5df6eb5..bd625f8 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -228,21 +228,16 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { $schema->storage->txn_begin; - my $biblio = - $schema->resultset('Biblio')->create( - { - title => "Test title", - biblioitems => [ - { - itemtype => 'BIB_LEVEL', - items => [ { itype => "ITEM_LEVEL" } ] - } - ] - } - ); - - my @bi = $biblio->biblioitems(); - my ( $item ) = $bi[0]->items(); + my $biblio = $schema->resultset('Biblio')->create({ + title => "Test title", + biblioitems => [ { itemtype => 'BIB_LEVEL' } ], + }); + my $biblioitem = $biblio->biblioitems->first; + my $item = $schema->resultset('Item')->create({ + biblioitemnumber => $biblioitem->biblioitemnumber, + biblionumber => $biblio->biblionumber, + itype => "ITEM_LEVEL", + }); t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); is( $item->effective_itemtype(), 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' ); -- 2.1.4