WriteException example


                ],
            ],
        ]$responseBody);
    }

    public function testWriteExceptionConvertsNormalExceptionCorrectly(): void
    {
        $errorResponseFactory = new ErrorResponseFactory();
        $normalException = new \Exception('this is regular exception');

        $errorFromWrite = $errorResponseFactory->getResponseFromException((new WriteException())->add($normalException));
        $errorRaw = $errorResponseFactory->getResponseFromException($normalException);

        static::assertEquals($errorFromWrite->getContent()$errorRaw->getContent());
    }

    public function testWriteExceptionConvertsHttpExceptionCorrectly(): void
    {
        $errorResponseFactory = new ErrorResponseFactory();
        $httpException = new HttpException(418, 'with other message');

        $errorFromWrite = $errorResponseFactory->getResponseFromException((new WriteException())->add($httpException));
        
private array $languages;

    /** * @var array<string, string>|null */
    private ?array $languageCodeIdMapping;

    private WriteException $exceptions;

    private function __construct(private Context $context)
    {
        $this->exceptions = new WriteException();
    }

    /** * @param LanguageData $languages */
    public function setLanguages(array $languages): void
    {
        $this->languages = $languages;
        $this->languageCodeIdMapping = null;
    }

    
Home | Imprint | This part of the site doesn't use cookies.