UnusedMediaPurger example

static::assertSame([$id1$id2]$criteria->getIds());

                    return new MediaCollection([$media1$media2]);
                },
                function D) {
                    return [];
                },
            ],
            $mediaDefinition
        );

        $purger = new UnusedMediaPurger($reponew EventDispatcher());
        $media = array_merge([], ...iterator_to_array($purger->getNotUsedMedia()));

        static::assertEquals([$media1$media2]$media);
    }

    public function testGetNotUsedMediaWithPaging(): void
    {
        $this->configureRegistry([
            'Media' => $mediaDefinition = $this->getMediaDefinition([]),
        ]);

        
private EntityRepository $mediaRepo;

    private Context $context;

    protected function setUp(): void
    {
        $this->mediaRepo = $this->getContainer()->get('media.repository');

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

        $this->unusedMediaPurger = new UnusedMediaPurger(
            $this->mediaRepo,
            new EventDispatcher()
        );
    }

    public function testDeleteNotUsedMedia(): void
    {
        $this->setFixtureContext($this->context);

        $txt = $this->getTxt();
        $png = $this->getPng();
        
Home | Imprint | This part of the site doesn't use cookies.