|
6 | 6 | use Olssonm\VeryBasicAuth\Tests\Fixtures\CustomResponseHandler; |
7 | 7 |
|
8 | 8 | use function Pest\Laravel\get; |
9 | | -use function Pest\Laravel\withHeader; |
| 9 | +use function Pest\Laravel\withHeaders; |
10 | 10 |
|
11 | 11 | test('basic auth filter is set', function () { |
12 | 12 | expect(in_array(VeryBasicAuth::class, $this->app->router->getMiddleware()))->toBeTrue(); |
|
36 | 36 | }); |
37 | 37 |
|
38 | 38 | test('request with incorrect credentials fails - text/html', function () { |
39 | | - $response = withHeader([ |
| 39 | + $response = withHeaders([ |
40 | 40 | 'PHP_AUTH_USER' => str_random(20), |
41 | 41 | 'PHP_AUTH_PW' => str_random(20), |
42 | 42 | ])->get('/'); |
|
48 | 48 | }); |
49 | 49 |
|
50 | 50 | test('request with incorrect credentials fails - json', function () { |
51 | | - $response = withHeader([ |
| 51 | + $response = withHeaders([ |
52 | 52 | 'PHP_AUTH_USER' => str_random(20), |
53 | 53 | 'PHP_AUTH_PW' => str_random(20), |
54 | 54 | 'Accept' => 'application/json', |
|
66 | 66 | test('request with incorrect credentials fails - view', function () { |
67 | 67 | config()->set('very_basic_auth.error_view', 'very_basic_auth::default'); |
68 | 68 |
|
69 | | - $response = withHeader([ |
| 69 | + $response = withHeaders([ |
70 | 70 | 'PHP_AUTH_USER' => str_random(20), |
71 | 71 | 'PHP_AUTH_PW' => str_random(20), |
72 | 72 | ])->get('/'); |
|
79 | 79 | }); |
80 | 80 |
|
81 | 81 | test('request with correct credentials passes', function () { |
82 | | - $response = withHeader([ |
| 82 | + $response = withHeaders([ |
83 | 83 | 'PHP_AUTH_USER' => config('very_basic_auth.user'), |
84 | 84 | 'PHP_AUTH_PW' => config('very_basic_auth.password'), |
85 | 85 | ])->get('/'); |
|
103 | 103 | }); |
104 | 104 |
|
105 | 105 | test('request with incorrect inline credentials fails', function () { |
106 | | - $response = withHeader([ |
| 106 | + $response = withHeaders([ |
107 | 107 | 'PHP_AUTH_USER' => str_random(20), |
108 | 108 | 'PHP_AUTH_PW' => str_random(20), |
109 | 109 | ])->get('/inline'); |
|
113 | 113 | }); |
114 | 114 |
|
115 | 115 | test('request with correct inline credentials passes', function () { |
116 | | - $response = withHeader([ |
| 116 | + $response = withHeaders([ |
117 | 117 | 'PHP_AUTH_USER' => config('very_basic_auth.user'), |
118 | 118 | 'PHP_AUTH_PW' => config('very_basic_auth.password'), |
119 | 119 | ])->get('/inline'); |
|
0 commit comments