| @@ 128-136 (lines=9) @@ | ||
| 125 | /** |
|
| 126 | * @test |
|
| 127 | */ |
|
| 128 | public function willSetResponseWithVndErrorHeader() |
|
| 129 | { |
|
| 130 | foreach ([400, 500] as $code) { |
|
| 131 | $this->codeProperty->setValue($this->exception, $code); |
|
| 132 | $this->exceptionListener->onKernelException($this->event); |
|
| 133 | $response = $this->event->getResponse(); |
|
| 134 | $this->assertContains('application/vnd.error', $response->headers->get('Content-Type')); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | ||
| 138 | /** |
|
| 139 | * @test |
|
| @@ 141-149 (lines=9) @@ | ||
| 138 | /** |
|
| 139 | * @test |
|
| 140 | */ |
|
| 141 | public function willSetResponseWithValidJsonContent() |
|
| 142 | { |
|
| 143 | foreach ([400, 500] as $code) { |
|
| 144 | $this->codeProperty->setValue($this->exception, $code); |
|
| 145 | $this->exceptionListener->onKernelException($this->event); |
|
| 146 | $response = $this->event->getResponse(); |
|
| 147 | $this->assertNotNull(json_decode($response->getContent())); |
|
| 148 | } |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @test |
|
| @@ 154-162 (lines=9) @@ | ||
| 151 | /** |
|
| 152 | * @test |
|
| 153 | */ |
|
| 154 | public function willSetResponseWithSimpleMessage() |
|
| 155 | { |
|
| 156 | foreach ([400 => 'Input Error', 500 => 'Server Error'] as $code => $message) { |
|
| 157 | $this->codeProperty->setValue($this->exception, $code); |
|
| 158 | $this->exceptionListener->onKernelException($this->event); |
|
| 159 | $response = $this->event->getResponse(); |
|
| 160 | $this->assertEquals($message, json_decode($response->getContent())->message); |
|
| 161 | } |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * @test |
|
| @@ 167-175 (lines=9) @@ | ||
| 164 | /** |
|
| 165 | * @test |
|
| 166 | */ |
|
| 167 | public function willSetResponseWithLogRef() |
|
| 168 | { |
|
| 169 | foreach ([400, 500] as $code) { |
|
| 170 | $this->codeProperty->setValue($this->exception, $code); |
|
| 171 | $this->exceptionListener->onKernelException($this->event); |
|
| 172 | $response = $this->event->getResponse(); |
|
| 173 | $this->assertNotNull(json_decode($response->getContent())->logref); |
|
| 174 | } |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * @test |
|