tests/Controller/BaseTestCase.php
/**
     * Test error messages
     *
     * @param ResponseInterface $response
     * @param int $errorCode
     */
Test error messages
@param ResponseInterface $response
@param int $errorCode
Test error messages @param ResponseInterface $response @param int $errorCode
protected function internalTestError(ResponseInterface $response, int $errorCode): void
    {
        self::assertSame($errorCode, $response->getStatusCode());
        $r_body = (string) $response->getBody();
        self::assertJson($r_body);
        self::assertStringContainsString('code', $r_body);
        self::assertStringContainsString('message', $r_body);
        try {
            $r_data = json_decode($r_body, true, 512, JSON_THROW_ON_ERROR);
            self::assertSame($errorCode, $r_data['code']);
            self::assertSame(Error::MESSAGES[$errorCode], $r_data['message']);
        } catch (Throwable $e) {
        }
    }
protected function internalTestError ( ResponseInterface $ response , int $ errorCode ) : void { self :: assertSame ( $ errorCode , $ response -> getStatusCode ( ) ) ; $ r_body = ( string ) $ response -> getBody ( ) ; self :: assertJson ( $ r_body ) ; self :: assertStringContainsString ( 'code' , $ r_body ) ; self :: assertStringContainsString ( 'message' , $ r_body ) ; try { $ r_data = json_decode ( $ r_body , true , 512 , JSON_THROW_ON_ERROR ) ; self :: assertSame ( $ errorCode , $ r_data [ 'code' ] ) ; self :: assertSame ( Error :: MESSAGES [ $ errorCode ] , $ r_data [ 'message' ] ) ; } catch ( Throwable $ e ) { } }
Test error messages
 @param ResponseInterface $response
 @param int $errorCode
Test error messages @param ResponseInterface $response @param int $errorCode