CustomFieldsUnusedMediaSubscriber example

parent::setUp();

        $this->mediaRepository = $this->getContainer()->get('media.repository');
        $this->customFieldSetRepository = $this->getContainer()->get('custom_field_set.repository');
    }

    public function testMediaIdsAreNotRemovedWhenMediaIsNotReferenced(): void
    {
        $mediaIds = array_values($this->createMedia(10)->all());

        $event = new UnusedMediaSearchEvent($mediaIds);
        $listener = new CustomFieldsUnusedMediaSubscriber(
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get(DefinitionInstanceRegistry::class)
        );

        $listener->removeUsedMedia($event);

        static::assertSame($mediaIds$event->getUnusedIds());
    }

    public function testMediaIdsFromAllPossibleLocationsAreRemovedFromEvent(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.