File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
web-developer/laravel/tips/testing Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ # header pass
3+
4+
5+ ``` php
6+ this->withHeaders([
7+ 'Accept' => 'application/json',
8+ 'Content-Type' => 'application/json',
9+ 'Authorization' => 'Bearer ' . 'abc',
10+ ])->json('GET', 'kala',[
11+ 'name' => 'kamal is here'
12+ ]);
13+ $response
14+ ->assertStatus(200)
15+ ->assertJson([
16+ 'name' => 'kamal is here',
17+ 'Authorization' => 'Bearer ' . 'abc'
18+ ]);
19+ ```
Original file line number Diff line number Diff line change 88./vendor/bin/phpunit --configuration /path/to/laravels/phpunit.xml
99```
1010
11+ # create command with cli
12+
13+ ``` bash
14+ php artisan make:test AppTest --unit
15+ ```
16+
1117# run
1218
1319``` bash
2430``` bash
2531composer global require phpunit/phpunit
2632```
33+
34+ # resources
35+
36+ * [ pusher] ( https://blog.pusher.com/tests-laravel-applications/ )
37+ * [ laravel-guide] ( https://laravel-guide.readthedocs.io/en/latest/application-testing/ )
38+ * [ phpunit api gist] ( https://gist.github.com/mostafa6765/2fe3765a74f51db4b53deb7c58139416 )
You can’t perform that action at this time.
0 commit comments