Bug 11518: (follow-up) Make unit tests pass
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 21 Apr 2014 12:20:28 +0000 (08:20 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 29 Apr 2014 15:06:24 +0000 (15:06 +0000)
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>
t/db_dependent/Items.t

index af7b252..6867f83 100755 (executable)
@@ -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' );