Код: Выделить всё
$response->assertStatus(200)->assertJsonStructure([
'success',
'message',
'data' => [
'*' =>[
'id',
'book_code',
'book_title',
'author',
'category',
'publisher',
'stock',
'book_cover',
'book_desc',
'barcode',
]
]
]);
< /code>
Но если я написал тест Show, подобный этот, индексный тест Fail (Code получен: 500, ожидаемый код: 200), но Show Test сдают успех < /p>
$response->assertStatus(200)->assertJsonStructure([
'success',
'message',
'data' =>[
'id',
'book_code',
'book_title',
'author',
'category',
'publisher',
'stock',
'book_cover',
'book_desc',
'barcode',
]
]);
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79643345/laravel-api-testing-index-and-show-data-fail-at-assertjsonstructure-of-nested-js[/url]