CategoryDefinition example

$this->createMock(AbstractKeyValueStorage::class)
        );

        $criteria = new Criteria();
        $criteria->addState(Criteria::STATE_ELASTICSEARCH_AWARE);

        static::assertTrue(
            $helper->allowSearch(new ProductDefinition(), Context::createDefaultContext()$criteria)
        );

        static::assertFalse(
            $helper->allowSearch(new CategoryDefinition(), Context::createDefaultContext()$criteria)
        );

        $helper->setEnabled(false);

        static::assertFalse(
            $helper->allowSearch(new ProductDefinition(), Context::createDefaultContext()$criteria)
        );
    }

    /** * @dataProvider enableMultilingualIndexCases */
/** * @internal * * @covers \Shopware\Storefront\Framework\Seo\SeoUrlRoute\NavigationPageSeoUrlRoute */
#[Package('buyers-experience')] class NavigationPageSeoUrlRouteTest extends TestCase
{
    public function testPrepareCriteria(): void
    {
        $navigationPageSeoUrlRoute = new NavigationPageSeoUrlRoute(
            new CategoryDefinition(),
            static::createStub(CategoryBreadcrumbBuilder::class)
        );

        $salesChannel = new SalesChannelEntity();

        $criteria = new Criteria();
        $navigationPageSeoUrlRoute->prepareCriteria($criteria$salesChannel);

        $filters = $criteria->getFilters();
        static::assertCount(2, $filters);

        
$this->dispatcher,
            new StockUpdateFilterProvider([]),
        );

        $stockSubscriber->triggerChangeSet($event);

        static::assertTrue($updateCommand->requiresChangeSet());
    }

    public function testTriggerChangeSetWithNotOrderLineItemDefinition(): void
    {
        $definition = new CategoryDefinition();
        $primaryKey = ['id' => 'some_id'];
        $existence = new EntityExistence('other_entity', [], false, false, false, []);
        $path = 'other_entities';

        $updateCommand = new UpdateCommand(
            $definition,
            ['some_field' => 'some_value'],
            $primaryKey,
            $existence,
            $path
        );

        
protected function setUp(): void
    {
        $aggregationParser = new AggregationParser();

        $this->staticDefinitionRegistry = new StaticDefinitionInstanceRegistry(
            [
                new ProductDefinition(),
                new ProductOptionDefinition(),
                new PropertyGroupOptionDefinition(),
                new ProductPriceDefinition(),
                new ProductCategoryDefinition(),
                new CategoryDefinition(),
            ],
            $this->createMock(ValidatorInterface::class),
            $this->createMock(EntityWriteGatewayInterface::class)
        );

        $this->requestCriteriaBuilder = new RequestCriteriaBuilder(
            $aggregationParser,
            new ApiCriteriaValidator($this->staticDefinitionRegistry),
            new CriteriaArrayConverter($aggregationParser),
        );
    }

    
static::assertEquals($rangeFilter->getField()$rangeFilter->getField());
            static::assertEquals($expectedRangeFilter->getParameters()$rangeFilter->getParameters());
        }
    }

    public function testCollectWithMappedConfigButEmptyManyToManyRelation(): void
    {
        $category = new CategoryEntity();
        $category->setUniqueIdentifier('category1');

        $container = new Container();
        $categoryDefinition = new CategoryDefinition();
        $productDefinition = new ProductDefinition();
        $categoryProductDefinition = new ProductCategoryDefinition();

        $container->set(CategoryDefinition::class$categoryDefinition);
        $container->set(ProductDefinition::class$productDefinition);
        $container->set(ProductCategoryDefinition::class$categoryProductDefinition);

        $container->set(ProductOptionDefinition::class$this->createMock(ProductOptionDefinition::class));
        $container->set(PropertyGroupOptionDefinition::class$this->createMock(PropertyGroupOptionDefinition::class));
        $container->set(ProductPropertyDefinition::class$this->createMock(ProductPropertyDefinition::class));
        $container->set(ProductStreamMappingDefinition::class$this->createMock(ProductStreamMappingDefinition::class));
        
static::assertEquals($expectedEvents, CategorySubscriber::getSubscribedEvents());
    }

    /** * @dataProvider entityLoadedEventDataProvider */
    public function testEntityLoadedEvent(SystemConfigService $systemConfigService, CategoryEntity $categoryEntity, ?string $cmsPageIdBeforeEvent, ?string $cmsPageIdAfterEvent, ?string $salesChannelId): void
    {
        $categorySubscriber = new CategorySubscriber($systemConfigService);

        if ($salesChannelId) {
            $event = new SalesChannelEntityLoadedEvent(new CategoryDefinition()[$categoryEntity]$this->getSalesChannelContext($salesChannelId));
        } else {
            $event = new EntityLoadedEvent(new CategoryDefinition()[$categoryEntity], Context::createDefaultContext());
        }

        static::assertEquals($cmsPageIdBeforeEvent$categoryEntity->getCmsPageId());
        $categorySubscriber->entityLoaded($event);
        static::assertEquals($cmsPageIdAfterEvent$categoryEntity->getCmsPageId());
    }

    /** * @return array<string, array{SystemConfigService, CategoryEntity, string|null, string|null, string|null}> */
Home | Imprint | This part of the site doesn't use cookies.