Level 5
One thing I mentioned: The error occurs once a test is running:
• Tests\Feature\AuthTest > user can log in via api
Mockery\Exception\BadMethodCallException
This is the test
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class AuthTest extends TestCase
{
use RefreshDatabase;
/**
* Test if the user can log in via HTTP API.
*
* @return void
*/
public function test_user_can_log_in_via_api()
{
$user = User::where('email', '[email protected]')->first();
$body = [
'email' => $user->email,
'secret' => 'secret',
];
$this->json('POST', '/api/auth/login', $body, [
'Accept' => 'application/json',
])->assertStatus(200)->assertJsonStructure([
'token_type',
'expires_at',
'access_token',
]);
}
}
It seems that use RefreshDatabase is causing this issue.