use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Orders;
+use t::lib::TestBuilder;
use t::lib::Mocks;
my $schema = Koha::Database->new()->schema();
my $dbh = C4::Context->dbh;
$dbh->{RaiseError} = 1;
-t::lib::Mocks::mock_userenv({ branchcode => 'CPL' });
+my $builder = t::lib::TestBuilder->new;
+my $logged_in_user = $builder->build_object({ class => 'Koha::Patrons' });
+t::lib::Mocks::mock_userenv({ patron => $logged_in_user });
my $bookseller = Koha::Acquisition::Bookseller->new(
{
$order = Koha::Acquisition::Orders->find( $ordernumber );
is( $order->quantityreceived, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' );
is( $order->entrydate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->store set entrydate to today' );
-is( $order->created_by, 42, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' );
+is( $order->created_by, $logged_in_user->borrowernumber, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' );
$schema->storage->txn_rollback();
"Supplier1 has late orders and $daysago10==$daysago10 " )
;
-t::lib::Mocks::mock_userenv({ flags => 0 });
+t::lib::Mocks::mock_userenv({ flags => 0, branchcode => 'BRANCH1' });
my $module = Test::MockModule->new('C4::Auth');
$module->mock(
);
# don the cape and turn into Superlibrarian!
-t::lib::Mocks::mock_userenv({ flags => 1 });
+t::lib::Mocks::mock_userenv({ flags => 1, branchcode => 'BRANCH1' });
@subscriptions = SearchSubscriptions({expiration_date => '2013-12-31'});
is(
scalar(grep { !$_->{cannotdisplay} } @subscriptions ),