Bug 24062: Fix the failing test
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 19 Nov 2019 08:40:07 +0000 (09:40 +0100)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Thu, 11 Jun 2020 16:06:14 +0000 (18:06 +0200)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

(cherry picked from commit cbe22553fe4bdcb9bf1bfc127dd4371f09ef43e9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

t/db_dependent/Circulation.t

index 8bed007..4d26b05 100755 (executable)
@@ -1936,34 +1936,31 @@ subtest 'AddReturn + suspension_chargeperiod' => sub {
 subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
     plan tests => 2;
 
-    my $library = $builder->build( { source => 'Branch' } );
+    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
     my $patron1 = $builder->build_object(
         {
             class => 'Koha::Patrons',
-            value  => {
-                branchcode => $library->{branchcode},
-                firstname => "Happy",
-                surname => "Gilmore",
+            value => {
+                library      => $library->branchcode,
+                categorycode => $patron_category->{categorycode}
             }
         }
     );
     my $patron2 = $builder->build_object(
         {
             class => 'Koha::Patrons',
-            value  => {
-                branchcode => $library->{branchcode},
-                firstname => "Billy",
-                surname => "Madison",
+            value => {
+                library      => $library->branchcode,
+                categorycode => $patron_category->{categorycode}
             }
         }
     );
 
-    C4::Context->_new_userenv('xxx');
-    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
+    t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode });
 
     my $item = $builder->build_sample_item(
         {
-            library      => $library->{branchcode},
+            library      => $library->branchcode,
         }
     )->unblessed;