Bug 24277: Regression tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 8 Jan 2020 13:55:40 +0000 (10:55 -0300)
committerHayley Mapley <hayleymapley@catalyst.net.nz>
Sun, 9 Feb 2020 22:22:37 +0000 (11:22 +1300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 76f7c46613687b712fa2342049557f2a769db8bf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b57a0462ecf12c1353d8650febf6feab89e4ff60)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

t/db_dependent/Acquisition.t

index 9f0374f..5a5cf55 100755 (executable)
@@ -19,9 +19,11 @@ use Modern::Perl;
 
 use POSIX qw(strftime);
 
-use Test::More tests => 76;
+use Test::More tests => 78;
 use t::lib::Mocks;
 use Koha::Database;
+use Koha::DateUtils qw(dt_from_string output_pref);
+use Koha::Acquisition::Basket;
 
 use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => 'MARC21' );
 
@@ -303,16 +305,36 @@ my $invoiceid = AddInvoice(
 
 my $invoice = GetInvoice( $invoiceid );
 
+my $reception_date = output_pref(
+    {
+            dt => dt_from_string->add( days => 1 ),
+            dateformat => 'iso',
+            dateonly => 1,
+    }
+);
 my ($datereceived, $new_ordernumber) = ModReceiveOrder(
     {
         biblionumber      => $biblionumber4,
         order             => Koha::Acquisition::Orders->find( $ordernumbers[4] )->unblessed,
         quantityreceived  => 1,
         invoice           => $invoice,
-        budget_id          => $order_content[4]->{str}->{budget_id},
+        budget_id         => $order_content[4]->{str}->{budget_id},
+        datereceived      => $reception_date,
     }
 );
 
+is(
+    output_pref(
+        {
+            dt         => dt_from_string($datereceived),
+            dateformat => 'iso',
+            dateonly   => 1
+        }
+    ),
+    $reception_date,
+    'ModReceiveOrder sets the passed date'
+);
+
 my $search_orders = SearchOrders({
     booksellerid => $booksellerid,
     basketno     => $basketno