ProductCategoryPathsSubscriber example

/** * @dataProvider provideCategoryPaths */
    public function testCategoryPathToAssignment(array $categoriesToWrite, array $record, array $row, array $assertion): void
    {
        $context = Context::createDefaultContext();

        $this->categoryRepository->upsert($categoriesToWrite$context);

        $event = new ImportExportBeforeImportRecordEvent($record$rownew Config([]['sourceEntity' => ProductDefinition::ENTITY_NAME][])$context);

        $subscriber = new ProductCategoryPathsSubscriber($this->categoryRepository, $this->getContainer()->get(SyncService::class));

        $subscriber->categoryPathsToAssignment($event);

        static::assertSame($assertion$event->getRecord()['categories']);
    }
}
Home | Imprint | This part of the site doesn't use cookies.