Bug 29234: (QA follow-up) Fix test that expects wrong defaults
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 31 Mar 2023 16:30:14 +0000 (18:30 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 31 Mar 2023 16:35:54 +0000 (18:35 +0200)
This patch changes the get_items_that_can_fill tests so they explicitly
set a 'datearrived' as the new defaults for fresh transfer objects from
TestBuilder is more sane and has this field undef. Tests *should always*
create their required scenarios explicitly.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
t/db_dependent/Holds.t
t/lib/TestBuilder.pm

index 29e773e..c5c79b1 100755 (executable)
@@ -1738,10 +1738,15 @@ subtest 'Koha::Holds->get_items_that_can_fill returns items with datecancelled o
     my $biblio2 = $builder->build_sample_biblio();
     my $item2 = $builder->build_sample_item({ biblionumber => $biblio2->biblionumber });
 
-    my $transfer2 = $builder->build_object({ class => "Koha::Item::Transfers", value => {
-        datecancelled => undef,
-        itemnumber => $item2->itemnumber
-    }});
+    my $transfer2 = $builder->build_object(
+        {   class => "Koha::Item::Transfers",
+            value => {
+                datearrived   => dt_from_string,
+                datecancelled => undef,
+                itemnumber    => $item2->itemnumber
+            }
+        }
+    );
 
     my $hold2 = $builder->build_object({ class => 'Koha::Holds', value => {
         biblionumber => $biblio2->biblionumber,
index 59137b1..d393cc8 100644 (file)
@@ -592,7 +592,7 @@ sub _gen_default_values {
         },
         Branchtransfer => {
             daterequested      => dt_from_string(),
-            datesent           => dt_from_string(),
+            datesent           => undef,
             datearrived        => undef,
             datecancelled      => undef,
             reason             => undef,