Bug 21652: Unit test
authorNick Clemens <nick@bywatersolutions.com>
Fri, 14 Jan 2022 14:17:02 +0000 (14:17 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Sat, 29 Jan 2022 07:52:54 +0000 (21:52 -1000)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
t/db_dependent/Hold.t

index abeae5c..d258e70 100755 (executable)
@@ -29,7 +29,7 @@ use Koha::Item;
 use Koha::DateUtils qw( dt_from_string );
 use t::lib::TestBuilder;
 
-use Test::More tests => 34;
+use Test::More tests => 35;
 use Test::Exception;
 use Test::Warn;
 
@@ -225,6 +225,25 @@ subtest "store() tests" => sub {
     $schema->storage->txn_rollback();
 };
 
+subtest "set_waiting() tests" => sub {
+
+    plan tests => 1;
+
+    $schema->storage->txn_begin();
+
+    # Disable logging
+    t::lib::Mocks::mock_preference( 'HoldsLog', 0 );
+
+    my $hold = $builder->build_object({ class => 'Koha::Holds' });
+
+    $hold->waitingdate('2021-01-01');
+
+    $hold->set_waiting();
+
+    is($hold->waitingdate,'2021-01-01',"Setting waiting when already waiting should not update waitingdate");
+
+};
+
 subtest "delete() tests" => sub {
 
     plan tests => 6;