Skip to content

Commit 56d5602

Browse files
author
Mostafa Kamal
committed
laravel testing
1 parent 5dcf0f4 commit 56d5602

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
```

web-developer/laravel/tips/testing/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
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
@@ -24,3 +30,9 @@
2430
```bash
2531
composer 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)

0 commit comments

Comments
 (0)