J
J
jazzus2020-02-16 02:24:25
Laravel
jazzus, 2020-02-16 02:24:25

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());

Data comes to vue. How to access a field in a test?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NubasLol, 2020-02-17
@jazzus

$response->json('data')['hasFiles']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question