2 use Test::More tests => 2;
12 use t::lib::TestBuilder;
16 *C4::Context::userenv = \&Mock_userenv;
18 my $schema = Koha::Database->schema;
19 $schema->storage->txn_begin;
20 my $builder = t::lib::TestBuilder->new;
22 my $library = $builder->build({
26 my $record = MARC::Record->new();
27 my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
29 my ( undef, undef, $itemnumber ) = AddItem(
31 homebranch => $library->{branchcode},
32 holdingbranch => $library->{branchcode},
33 barcode => 'i_dont_exist',
35 permanent_location => 'TEST'
42 t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 1 );
43 AddReturn( 'i_dont_exist', $library->{branchcode} );
44 $item = GetItem($itemnumber);
45 is( $item->{location}, 'CART', "InProcessingToShelvingCart functions as intended" );
47 $item->{location} = 'PROC';
48 ModItem( $item, undef, $itemnumber );
50 t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 0 );
51 AddReturn( 'i_dont_exist', $library->{branchcode} );
52 $item = GetItem($itemnumber);
53 is( $item->{location}, 'TEST', "InProcessingToShelvingCart functions as intended" );
55 # C4::Context->userenv
57 return { branch => $library->{branchcode} };