From adfdd3b21f821953d4f07145ef3a1e9ab79be0cf Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 10 Feb 2015 10:23:25 +0100 Subject: [PATCH] Bug 12395: Add unit test to check created_by is correctly set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Paola Rossi Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- t/db_dependent/Acquisition/NewOrder.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Acquisition/NewOrder.t b/t/db_dependent/Acquisition/NewOrder.t index b327a8d878..b17dcec7dc 100644 --- a/t/db_dependent/Acquisition/NewOrder.t +++ b/t/db_dependent/Acquisition/NewOrder.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 7; +use Test::More tests => 8; use C4::Acquisition; use C4::Biblio; use C4::Budgets; @@ -17,6 +17,10 @@ $schema->storage->txn_begin(); my $dbh = C4::Context->dbh; $dbh->{RaiseError} = 1; +C4::Context->_new_userenv('xxx'); +C4::Context->set_userenv(42, 'ordercreator', '0042', 'Order', 'Creator', 'CPL', + 0, 'ordercreator@example.com'); + my $bookseller = Koha::Acquisition::Bookseller->new( { name => "my vendor", @@ -86,5 +90,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' ); $schema->storage->txn_rollback(); -- 2.39.5