Feature test, expected ExactJson
How to get the expected form of json.
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'{"data":{"childrens":{"name":"Dr.","slug":"dr"},"name":"Prof.","slug":"prof"}}'
+'{"data":[{"childrens":[{"name":"Dr.","slug":"dr"}],"name":"Prof.","slug":"prof"}]}
$response->assertStatus(200)
->assertExactJson([
"data" => [
"name" => $categories->name,
"slug" => $categories->slug,
"childrens" => [
"name" => $anotherCategory->name,
"slug" => $anotherCategory->slug,
]
]
]);
->assertExactJson([
"data" => [
[
"name" => $categories->name,
"slug" => $categories->slug,
"childrens" => [
[
"name" => $anotherCategory->name,
"slug" => $anotherCategory->slug,
]
]
]
]
]);
try this
Please or to participate in this conversation.