Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amsoell/assert-json-structure-missing
Laravel unit test assertion that tests for the absence of a JSON structure
https://github.com/amsoell/assert-json-structure-missing
laravel laravel-5-package laravel-testing phpunit phpunit-assertions
Last synced: 29 days ago
JSON representation
Laravel unit test assertion that tests for the absence of a JSON structure
- Host: GitHub
- URL: https://github.com/amsoell/assert-json-structure-missing
- Owner: amsoell
- Created: 2018-02-26T11:19:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-26T12:44:32.000Z (almost 7 years ago)
- Last Synced: 2025-01-03T01:08:36.294Z (about 1 month ago)
- Topics: laravel, laravel-5-package, laravel-testing, phpunit, phpunit-assertions
- Language: PHP
- Homepage:
- Size: 1000 Bytes
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TestResponse::assertJsonStructureMissing
The `TestResponse::assertJsonStructureMissing` assertion works just like [TestResponse::assertJsonStructure](https://laravel.com/api/5.6/Illuminate/Foundation/Testing/TestResponse.html#method_assertJsonStructure), except that it tests for the absence of a particular structure.
```
$response = $this->get('/data');
$response->assertJsonStructureMissing([
'data' => [
'related' => [
'*' => [
'attribute',
],
],
],
]);
```Full credit for this package goes to [Behzad Shabani](https://github.com/behzadsh). This package just takes his [pull request](https://github.com/laravel/framework/pull/20435) and packages it up so it's super easy to add to your Laravel application.