| @@ 102-116 (lines=15) @@ | ||
| 99 | /** |
|
| 100 | * @test |
|
| 101 | */ |
|
| 102 | public function willLogExceptionsWith4xxCodesAsBadRequestNotices() |
|
| 103 | { |
|
| 104 | for ($i = 0; $i < 99; $i++) { |
|
| 105 | $logger = $this->getMockForAbstractClass(LoggerInterface::class); |
|
| 106 | $logger |
|
| 107 | ->expects($this->once()) |
|
| 108 | ->method('log') |
|
| 109 | ->with(LogLevel::NOTICE, $this->stringStartsWith('Bad Request')); |
|
| 110 | ||
| 111 | /** @var LoggerInterface $logger */ |
|
| 112 | $this->exceptionListener->setLogger($logger); |
|
| 113 | $this->codeProperty->setValue($this->exception, 400 + $i); |
|
| 114 | $this->exceptionListener->onKernelException($this->event); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * @test |
|
| @@ 121-135 (lines=15) @@ | ||
| 118 | /** |
|
| 119 | * @test |
|
| 120 | */ |
|
| 121 | public function willLogExceptionsWith5xxCodesAsRuntimeErrors() |
|
| 122 | { |
|
| 123 | for ($i = 0; $i < 99; $i++) { |
|
| 124 | $logger = $this->getMockForAbstractClass(LoggerInterface::class); |
|
| 125 | $logger |
|
| 126 | ->expects($this->once()) |
|
| 127 | ->method('log') |
|
| 128 | ->with(LogLevel::ERROR, $this->stringStartsWith('Internal Server Error')); |
|
| 129 | ||
| 130 | /** @var LoggerInterface $logger */ |
|
| 131 | $this->exceptionListener->setLogger($logger); |
|
| 132 | $this->codeProperty->setValue($this->exception, 500 + $i); |
|
| 133 | $this->exceptionListener->onKernelException($this->event); |
|
| 134 | } |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * @test |
|