Answer the question
In order to leave comments, you need to log in
How to access field in test from Resource?
You need to test the method in the controller that returns
new ProjectResource($project)
The resource has a field
Access to which must be obtained through the Feature test
'hasFiles' => $this->hasFiles(),
$response = $this->deleteJson($route)
->assertOk()
->assertJsonMissingValidationErrors()
// возвращает Failed asserting that an array has the key 'hasFiles'.
->assertJsonStructure(['hasFiles']);
// ProjectResource без поля в списке
dd($response->getOriginalContent());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question