mediaFolderIdNotFound example

$this->mediaFolderConfigRepo->clone($configId$context$newId);

        return $newId;
    }

    private function fetchFolder(string $folderId, Context $context): MediaFolderEntity
    {
        /** @var MediaFolderEntity|null $folder */
        $folder = $this->mediaFolderRepo->search(new Criteria([$folderId])$context)->get($folderId);

        if ($folder === null) {
            throw MediaException::mediaFolderIdNotFound($folderId);
        }

        return $folder;
    }
}
static::assertEquals(Response::HTTP_NOT_FOUND, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_MISSING_FILE, $exception->getErrorCode());
        static::assertEquals('Could not find file for media with id: "media-id"', $exception->getMessage());
        static::assertEquals(['mediaId' => $mediaId]$exception->getParameters());
    }

    public function testMediaFolderIdNotFound(): void
    {
        $folderId = 'folder-id';

        $exception = MediaException::mediaFolderIdNotFound($folderId);

        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';

        
$this->mediaFolderConfigRepo = $this->getContainer()->get('media_folder_configuration.repository');

        $this->context = Context::createDefaultContext();

        $this->mediaFolderService = $this->getContainer()->get(MediaFolderService::class);
    }

    public function testDissolveForNonExistingFolder(): void
    {
        $folderId = Uuid::randomHex();
        $this->expectException(MediaException::class);
        $this->expectExceptionMessage(MediaException::mediaFolderIdNotFound($folderId)->getMessage());

        $this->mediaFolderService->dissolve($folderId$this->context);
    }

    public function testDissolveWithNoChildFolders(): void
    {
        $this->setFixtureContext($this->context);
        $media = $this->getJpgWithFolder();

        $mediaFolderId = $media->getMediaFolderId();
        static::assertIsString($mediaFolderId);

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