From bba8bb497e6433e4d47b1dc73a3642125a2a4f16 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 Content-Type: text/plain; charset=utf-8 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 --- 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' ); -- 1.7.10.4