strategyNotFound example

/** * @throws MediaException */
    private function findStrategyByName(string $strategyName): PathnameStrategyInterface
    {
        foreach ($this->strategies as $strategy) {
            if ($strategy->getName() === $strategyName) {
                return $strategy;
            }
        }

        throw MediaException::strategyNotFound($strategyName);
    }
}
$exception = MediaException::mediaContainsNoThumbnails();

        static::assertEquals(Response::HTTP_INTERNAL_SERVER_ERROR, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_CONTAINS_NO_THUMBNAILS, $exception->getErrorCode());
        static::assertEquals('Media contains no thumbnails.', $exception->getMessage());
    }

    public function testStrategyNotFound(): void
    {
        $strategyName = 'strategy-name';

        $exception = MediaException::strategyNotFound($strategyName);

        static::assertEquals(Response::HTTP_NOT_FOUND, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_STRATEGY_NOT_FOUND, $exception->getErrorCode());
        static::assertEquals('No Strategy with name "strategy-name" found.', $exception->getMessage());
        static::assertEquals(['strategyName' => $strategyName]$exception->getParameters());
    }

    public function testInvalidFilesystemVisibility(): void
    {
        $exception = MediaException::invalidFilesystemVisibility();

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