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