mediaFolderNameNotFound example

$rawInput = $input->getOption('folder-name');
        if (empty($rawInput)) {
            return null;
        }

        $criteria = (new Criteria())
            ->addFilter(new EqualsFilter('name', $rawInput));

        $searchResult = $this->mediaFolderRepository->search($criteria$context);

        if ($searchResult->getTotal() === 0) {
            throw MediaException::mediaFolderNameNotFound($rawInput);
        }

        return new EqualsAnyFilter('mediaFolderId', $searchResult->getIds());
    }

    /** * @param RepositoryIterator<MediaCollection> $iterator * * @return array<string, int|array<array<string>>> */
    private function generateThumbnails(RepositoryIterator $iterator, Context $context): array
    {
static::assertEquals(Response::HTTP_NOT_FOUND, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_FOLDER_NOT_FOUND, $exception->getErrorCode());
        static::assertEquals('Could not find media folder with id: "folder-id"', $exception->getMessage());
        static::assertEquals(['folderId' => $folderId]$exception->getParameters());
    }

    public function testMediaFolderNameNotFound(): void
    {
        $folderName = 'folder-name';

        $exception = MediaException::mediaFolderNameNotFound($folderName);

        static::assertEquals(Response::HTTP_NOT_FOUND, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_FOLDER_NAME_NOT_FOUND, $exception->getErrorCode());
        static::assertEquals('Could not find a folder with the name: "folder-name"', $exception->getMessage());
        static::assertEquals(['folderName' => $folderName]$exception->getParameters());
    }

    public function testFileExtensionNotSupported(): void
    {
        $mediaId = 'media-id';
        $extension = 'extension';

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