Skip to content

Commit

Permalink
Passing E_USER_ERROR to trigger_error is deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <george@net-glue.co.uk>
  • Loading branch information
gsteel committed Oct 10, 2024
1 parent 96d26a6 commit 157b5d4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/ProblemDetailsMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
use function trigger_error;

use const E_USER_ERROR;

Check failure on line 22 in test/ProblemDetailsMiddlewareTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Type E_USER_ERROR is not used in this file.
use const E_USER_NOTICE;

Check failure on line 23 in test/ProblemDetailsMiddlewareTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Type E_USER_NOTICE is not used in this file.
use const E_USER_WARNING;

class ProblemDetailsMiddlewareTest extends TestCase
{
Expand Down Expand Up @@ -107,16 +109,16 @@ public function testMiddlewareRegistersErrorHandlerToConvertErrorsToProblemDetai
->method('handle')
->with($this->request)
->willReturnCallback(static function (): void {
trigger_error('Triggered error!', E_USER_ERROR);
trigger_error('Triggered error!', E_USER_WARNING);
});

$expected = $this->createMock(ResponseInterface::class);
$this->responseFactory
->method('createResponseFromThrowable')
->with($this->request, self::callback(function ($e): bool {
self::assertInstanceOf(ErrorException::class, $e);
self::assertEquals(E_USER_ERROR, $e->getSeverity());
self::assertEquals('Triggered error!', $e->getMessage());
self::assertInstanceOf(ErrorException::class, $e);
self::assertEquals(E_USER_WARNING, $e->getSeverity());
return true;
}))
->willReturn($expected);
Expand Down

0 comments on commit 157b5d4

Please sign in to comment.