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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2016-04-01 09:24:04 +02:00 committed by Kyle M Hall
parent 503cc30d9a
commit 1608b89b7f
1 changed files with 10 additions and 15 deletions

View File

@ -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' );