- Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Description
- Laravel Version: 5.4.28
- PHP Version: 7.1.5
Description:
Let's say we have an API that would return a json like this:
{ "foo": "bar", "baz": { "qux": "quux", "corge": "uier" } }
and we want to test that corge
inside baz
object is missing
<?php class ExampleTest extends TestCase { public function testJsonMissing() { $response = $this->json('GET', "/api/foobar"); $response->assertJsonMissing(['foo']) // this is ok and will be failed ->assertJsonMissing(['baz' => ['corge']]); // this should fail but will pass } }
The test should fail but it will pass!
pedzed and Gnative
Metadata
Metadata
Assignees
Labels
No labels