V
V
vladislav9972021-12-14 11:56:48
Unit testing
vladislav997, 2021-12-14 11:56:48

Why does the test fail with Failed asserting that an array has the key 'id'?

Tell me why the error when testing Failed asserting that an array has the key 'id' ?

public function test_qr_code_customer()
{
    $token = 'v4jdlUW5W370VchqlSIDzL5LHjqxXv4jgo37dTP2';

    $response = $this->withHeaders([
        'Authorization' => 'Bearer ' . $token,
    ])->get('/api/qr-code/customer');

    $response
        ->assertOk()
        ->assertJsonStructure([
            'ok',
            'data' => [
                'user' => [
                    'id',
                    'code'
                ]
            ]
        ])
    ;
}

61b85b7e80c33837280195.png

and the actual error
61b85f5e13e4b107626162.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2021-12-14
@Fragster

like it's about name and not about id
SDpZZqv.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question