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(); |