Answer the question
In order to leave comments, you need to log in
Why is a record deleted from the database during tests?
There is this test:
public function test_isset_user_in_database()
{
$this->post('/api/v2/token/get', ['google_id' => $this->getGoogleID()]);
$this->assertDatabaseHas('app_users', ['google_id' => $this->getGoogleID()]);
}
protected function setUp(): void
{
parent::setUp();
$response = $this->post('/api/v2/token/get', ['google_id' => $this->getGoogleID()]);
$responseJSON = $response->json();
$this->setJWTToken($responseJSON['data']['token']);
}
public function getOrCreateByGoogleID(string $googleID): ?AppUserModel
{
try {
return $this->model::firstOrCreate(['google_id' => $googleID]);
} catch (QueryException $e) {
}
return null;
}
Answer the question
In order to leave comments, you need to log in
Somehow everything got fixed
Maybe it's Laravel's request limits or the cache. At some point, I indicated in the test config to separately make php processes for each test.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question