thumbnailAssociationNotLoaded example

 {
    }

    public function generate(MediaCollection $collection, Context $context): int
    {
        $delete = [];

        $generate = [];

        foreach ($collection as $media) {
            if ($media->getThumbnails() === null) {
                throw MediaException::thumbnailAssociationNotLoaded();
            }

            if (!$this->mediaCanHaveThumbnails($media$context)) {
                $delete = [...$delete, ...$media->getThumbnails()->getIds()];

                continue;
            }

            $mediaFolder = $media->getMediaFolder();
            if ($mediaFolder === null) {
                continue;
            }
public function testInvalidBatchSize(): void
    {
        $exception = MediaException::invalidBatchSize();

        static::assertEquals(Response::HTTP_BAD_REQUEST, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_INVALID_BATCH_SIZE, $exception->getErrorCode());
        static::assertEquals('Provided batch size is invalid.', $exception->getMessage());
    }

    public function testThumbnailAssociationNotLoaded(): void
    {
        $exception = MediaException::thumbnailAssociationNotLoaded();

        static::assertEquals(Response::HTTP_BAD_REQUEST, $exception->getStatusCode());
        static::assertEquals(MediaException::MEDIA_THUMBNAIL_ASSOCIATION_NOT_LOADED, $exception->getErrorCode());
        static::assertEquals('Thumbnail association not loaded - please pre load media thumbnails.', $exception->getMessage());
    }

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

        $exception = MediaException::mediaTypeNotLoaded($mediaId);

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