Bug 21817: Fix 2 failing tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8748d80109)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2018-12-11 12:28:53 -03:00 committed by Martin Renvoize
parent 336fedc15d
commit c24fded0f9
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,7 @@ use Koha::Database;
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();
@ -18,7 +19,9 @@ $schema->storage->txn_begin();
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(
{
@ -89,6 +92,6 @@ my $ordernumber = $order->ordernumber;
$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();

View File

@ -639,7 +639,7 @@ ok( exists( $suppliers{$id_supplier1} ),
"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(
@ -670,7 +670,7 @@ is(
);
# 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 ),