Bug 21231: Add Unit Test
authorKyle M Hall <kyle@bywatersolutiosn.com>
Thu, 16 Aug 2018 11:10:43 +0000 (07:10 -0400)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 30 Aug 2018 13:40:30 +0000 (13:40 +0000)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
t/db_dependent/Circulation/Returns.t

index 50f733b..bd21347 100644 (file)
@@ -337,7 +337,7 @@ subtest 'Handle ids duplication' => sub {
 };
 
 subtest 'BlockReturnOfLostItems' => sub {
-    plan tests => 3;
+    plan tests => 4;
     my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
     my $item = $builder->build_object(
         {
@@ -361,6 +361,9 @@ subtest 'BlockReturnOfLostItems' => sub {
     is( $doreturn, 0, "With BlockReturnOfLostItems, a checkin of a lost item should be blocked");
     is( $messages->{WasLost}, 1, "... and the WasLost flag should be set");
 
+    $item->discard_changes;
+    is( $item->itemlost, 1, "Item remains lost" );
+
     t::lib::Mocks::mock_preference('BlockReturnOfLostItems', 0);
     ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
     is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");