View | Details | Raw Unified | Return to bug 21817
Collapse All | Expand All

(-)a/t/db_dependent/Acquisition/NewOrder.t (-2 / +5 lines)
Lines 11-16 use Koha::Database; Link Here
11
use Koha::DateUtils qw( dt_from_string output_pref );
11
use Koha::DateUtils qw( dt_from_string output_pref );
12
use Koha::Acquisition::Booksellers;
12
use Koha::Acquisition::Booksellers;
13
use Koha::Acquisition::Orders;
13
use Koha::Acquisition::Orders;
14
use t::lib::TestBuilder;
14
use t::lib::Mocks;
15
use t::lib::Mocks;
15
16
16
my $schema = Koha::Database->new()->schema();
17
my $schema = Koha::Database->new()->schema();
Lines 18-24 $schema->storage->txn_begin(); Link Here
18
my $dbh = C4::Context->dbh;
19
my $dbh = C4::Context->dbh;
19
$dbh->{RaiseError} = 1;
20
$dbh->{RaiseError} = 1;
20
21
21
t::lib::Mocks::mock_userenv({ branchcode => 'CPL' });
22
my $builder = t::lib::TestBuilder->new;
23
my $logged_in_user = $builder->build_object({ class => 'Koha::Patrons' });
24
t::lib::Mocks::mock_userenv({ patron => $logged_in_user });
22
25
23
my $bookseller = Koha::Acquisition::Bookseller->new(
26
my $bookseller = Koha::Acquisition::Bookseller->new(
24
    {
27
    {
Lines 89-94 my $ordernumber = $order->ordernumber; Link Here
89
$order = Koha::Acquisition::Orders->find( $ordernumber );
92
$order = Koha::Acquisition::Orders->find( $ordernumber );
90
is( $order->quantityreceived, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' );
93
is( $order->quantityreceived, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' );
91
is( $order->entrydate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->store set entrydate to today' );
94
is( $order->entrydate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->store set entrydate to today' );
92
is( $order->created_by, 42, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' );
95
is( $order->created_by, $logged_in_user->borrowernumber, 'Koha::Acquisition::Order->store set created_by to logged in user if not given' );
93
96
94
$schema->storage->txn_rollback();
97
$schema->storage->txn_rollback();
(-)a/t/db_dependent/Bookseller.t (-3 / +2 lines)
Lines 639-645 ok( exists( $suppliers{$id_supplier1} ), Link Here
639
    "Supplier1 has late orders and $daysago10==$daysago10 " )
639
    "Supplier1 has late orders and $daysago10==$daysago10 " )
640
  ;
640
  ;
641
641
642
t::lib::Mocks::mock_userenv({ flags => 0 });
642
t::lib::Mocks::mock_userenv({ flags => 0, branchcode => 'BRANCH1' });
643
643
644
my $module = Test::MockModule->new('C4::Auth');
644
my $module = Test::MockModule->new('C4::Auth');
645
$module->mock(
645
$module->mock(
Lines 670-676 is( Link Here
670
);
670
);
671
671
672
# don the cape and turn into Superlibrarian!
672
# don the cape and turn into Superlibrarian!
673
t::lib::Mocks::mock_userenv({ flags => 1 });
673
t::lib::Mocks::mock_userenv({ flags => 1, branchcode => 'BRANCH1' });
674
@subscriptions = SearchSubscriptions({expiration_date => '2013-12-31'});
674
@subscriptions = SearchSubscriptions({expiration_date => '2013-12-31'});
675
is(
675
is(
676
    scalar(grep { !$_->{cannotdisplay} } @subscriptions ),
676
    scalar(grep { !$_->{cannotdisplay} } @subscriptions ),
677
- 

Return to bug 21817