Bug 22008: (follow-up) Additional fix for bad test
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 27 Mar 2019 14:47:27 +0000 (14:47 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 27 Mar 2019 15:04:59 +0000 (15:04 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
t/db_dependent/Circulation/Returns.t

index 88182cd..2f09606 100644 (file)
@@ -39,10 +39,19 @@ use MARC::Field;
 
 # Mock userenv, used by AddIssue
 my $branch;
+my $manager_id;
 my $context = Test::MockModule->new('C4::Context');
-$context->mock( 'userenv', sub {
-    return { branch => $branch, number => 1234, firstname => "Adam", surname => "Smaith" }
-});
+$context->mock(
+    'userenv',
+    sub {
+        return {
+            branch    => $branch,
+            number    => $manager_id,
+            firstname => "Adam",
+            surname   => "Smaith"
+        };
+    }
+);
 
 my $schema = Koha::Database->schema;
 $schema->storage->txn_begin;
@@ -59,6 +68,9 @@ my $rule = Koha::IssuingRule->new(
 );
 $rule->store();
 
+my $manager = $builder->build({source => 'Borrower'});
+$manager_id = $manager->{borrowernumber};
+
 subtest "InProcessingToShelvingCart tests" => sub {
 
     plan tests => 2;