Bug 11518: (follow-up) Make unit tests pass

This works around a problem where the database handle
returned by C4::Context->dbh() is not the same as the one
used by Koha::Database.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kyle Hall 2014-04-21 08:20:28 -04:00 committed by Galen Charlton
parent 8a27907948
commit ddab9e939b

View file

@ -22,7 +22,7 @@ use MARC::Record;
use C4::Biblio;
use Koha::Database;
use Test::More tests => 3;
use Test::More tests => 4;
BEGIN {
use_ok('C4::Items');
@ -169,10 +169,10 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub {
my $biblioitem = $biblio->biblioitem();
my ( $item ) = $biblioitem->items();
C4::Context->set_preference( 'item-level_itypes', 0 );
$schema->resultset('Systempreference')->update_or_create({ variable => 'item-level_itypes', value => 0 });
ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
C4::Context->set_preference( 'item-level_itypes', 1 );
$schema->resultset('Systempreference')->update_or_create({ variable => 'item-level_itypes', value => 1 });
ok( $item->effective_itemtype() eq 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is disabled' );