6

I have a test that looks like so:

$user = factory(User::class)->state('verified')->create();

$this->be($user);
$file = new UploadedFile(storage_path('testing/user.jpg'), 'user.jpg', 'image/jpeg');

$this->post('/account/missing-fields/upload', [
    'file' => $file
], ['Content-Type' => 'multipart/form-data'])->dump();
$this->post('/account/missing-fields/upload', [
    'file' => $file
], ['Content-Type' => 'multipart/form-data'])->dump();
{#2983
  +"token": "hHAY7vD8fOiW8mVU9OIlxVSJv5FzAq52e0coaFHKRC"
  +"extension": "jpg"
  +"mime": "image/jpeg"
}
{#3072
  +"message": "Method Illuminate\Auth\RequestGuard::viaRemember does not exist."
  +"exception": "BadMethodCallException"
  +"file": "/app/backend/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php"
   ...
}

As you can see, the first request is successful, and returns a token, when I do the request a second time, Laravel is suddenly saying that the viaRemember method doesn't exist.

I have no clue why is shouldn't be working.

It should be noted that I can change the post requests, and the second will always fail like above.

Going through the framework, the error occurs within Illuminate\Session\Middleware\AuthenticateSession, where the first request has one web guard and the second for some reason has web and airlock.

enter image description here

Jazerix
  • 4,729
  • 10
  • 39
  • 71

0 Answers0