| @@ 146-154 (lines=9) @@ | ||
| 143 | /** |
|
| 144 | * @test |
|
| 145 | */ |
|
| 146 | public function willSetResponseWithVndErrorHeader() |
|
| 147 | { |
|
| 148 | foreach ([400, 500] as $code) { |
|
| 149 | $this->codeProperty->setValue($this->exception, $code); |
|
| 150 | $this->exceptionListener->onKernelException($this->event); |
|
| 151 | $response = $this->event->getResponse(); |
|
| 152 | $this->assertContains('application/vnd.error', $response->headers->get('Content-Type')); |
|
| 153 | } |
|
| 154 | } |
|
| 155 | ||
| 156 | /** |
|
| 157 | * @test |
|
| @@ 159-167 (lines=9) @@ | ||
| 156 | /** |
|
| 157 | * @test |
|
| 158 | */ |
|
| 159 | public function willSetResponseWithValidJsonContent() |
|
| 160 | { |
|
| 161 | foreach ([400, 500] as $code) { |
|
| 162 | $this->codeProperty->setValue($this->exception, $code); |
|
| 163 | $this->exceptionListener->onKernelException($this->event); |
|
| 164 | $response = $this->event->getResponse(); |
|
| 165 | $this->assertNotNull(json_decode($response->getContent())); |
|
| 166 | } |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * @test |
|
| @@ 172-180 (lines=9) @@ | ||
| 169 | /** |
|
| 170 | * @test |
|
| 171 | */ |
|
| 172 | public function willSetResponseWithSimpleMessage() |
|
| 173 | { |
|
| 174 | foreach ([400 => 'Bad Request', 500 => 'Internal Server Error'] as $code => $message) { |
|
| 175 | $this->codeProperty->setValue($this->exception, $code); |
|
| 176 | $this->exceptionListener->onKernelException($this->event); |
|
| 177 | $response = $this->event->getResponse(); |
|
| 178 | $this->assertEquals($message, json_decode($response->getContent())->message); |
|
| 179 | } |
|
| 180 | } |
|
| 181 | ||
| 182 | /** |
|
| 183 | * @test |
|
| @@ 185-193 (lines=9) @@ | ||
| 182 | /** |
|
| 183 | * @test |
|
| 184 | */ |
|
| 185 | public function willSetResponseWithLogRef() |
|
| 186 | { |
|
| 187 | foreach ([400, 500] as $code) { |
|
| 188 | $this->codeProperty->setValue($this->exception, $code); |
|
| 189 | $this->exceptionListener->onKernelException($this->event); |
|
| 190 | $response = $this->event->getResponse(); |
|
| 191 | $this->assertNotNull(json_decode($response->getContent())->logref); |
|
| 192 | } |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * @test |
|