|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -namespace Spatie\HttpLogger\Test; |
4 |
| - |
5 | 3 | use Illuminate\Http\UploadedFile;
|
6 | 4 |
|
7 | 5 | use function PHPUnit\Framework\assertStringContainsString;
|
|
13 | 11 | $this->logger = new DefaultLogWriter();
|
14 | 12 | });
|
15 | 13 |
|
16 |
| -test('it logs request method and uri', function () { |
| 14 | +it('logs request method and uri', function () { |
17 | 15 | foreach (['post', 'put', 'patch', 'delete'] as $method) {
|
18 | 16 | $request = $this->makeRequest($method, $this->uri);
|
19 | 17 |
|
|
28 | 26 | assertStringContainsString("DELETE {$this->uri}", $log);
|
29 | 27 | });
|
30 | 28 |
|
31 |
| -test('it will log the body', function () { |
| 29 | +it('will log the body', function () { |
32 | 30 | $request = $this->makeRequest('post', $this->uri, [
|
33 | 31 | 'name' => 'Name',
|
34 | 32 | ]);
|
|
40 | 38 | assertStringContainsString('"name":"Name', $log);
|
41 | 39 | });
|
42 | 40 |
|
43 |
| -test('it will not log excluded fields', function () { |
| 41 | +it('will not log excluded fields', function () { |
44 | 42 | $request = $this->makeRequest('post', $this->uri, [
|
45 | 43 | 'name' => 'Name',
|
46 | 44 | 'password' => 'none',
|
|
55 | 53 | assertStringNotContainsString('password_confirmation', $log);
|
56 | 54 | });
|
57 | 55 |
|
58 |
| -test('it logs files', function () { |
| 56 | +it('logs files', function () { |
59 | 57 | $file = $this->getTempFile();
|
60 | 58 |
|
61 | 59 | $request = $this->makeRequest('post', $this->uri, [], [], [
|
|
69 | 67 | assertStringContainsString('test.md', $log);
|
70 | 68 | });
|
71 | 69 |
|
72 |
| -test('it logs one file in an array', function () { |
| 70 | +it('logs one file in an array', function () { |
73 | 71 | $file = $this->getTempFile();
|
74 | 72 |
|
75 | 73 | $request = $this->makeRequest('post', $this->uri, [], [], [
|
|
85 | 83 | assertStringContainsString('test.md', $log);
|
86 | 84 | });
|
87 | 85 |
|
88 |
| -test('it logs multiple files in an array', function () { |
| 86 | +it('logs multiple files in an array', function () { |
89 | 87 | $file = $this->getTempFile();
|
90 | 88 |
|
91 | 89 | $request = $this->makeRequest('post', $this->uri, [], [], [
|
|
103 | 101 | assertStringContainsString('second.doc', $log);
|
104 | 102 | });
|
105 | 103 |
|
106 |
| -test('it logs using the default log level', function () { |
| 104 | +it('logs using the default log level', function () { |
107 | 105 | $request = $this->makeRequest('post', $this->uri, [
|
108 | 106 | 'name' => 'Name',
|
109 | 107 | ]);
|
|
116 | 114 | assertStringContainsString('"name":"Name', $log);
|
117 | 115 | });
|
118 | 116 |
|
119 |
| -test('it logs using the configured log level', function () { |
| 117 | +it('logs using the configured log level', function () { |
120 | 118 | config(['http-logger.log_level' => 'debug']);
|
121 | 119 | $request = $this->makeRequest('post', $this->uri, [
|
122 | 120 | 'name' => 'Name',
|
|
0 commit comments