SalesChannelDomainEntity example

static::assertInstanceOf(HreflangCollection::class$links);
        static::assertEquals(0, $links->count());
    }

    public function testProductWithOnlyOneDomain(): void
    {
        $productId = Uuid::randomHex();

        $languageId = $this->getContainer()->get('language.repository')->searchIds(new Criteria()$this->salesChannelContext->getContext())->firstId();
        static::assertNotNull($languageId);

        $domain = new SalesChannelDomainEntity();
        $domain->setId(Uuid::randomHex());
        $domain->setUrl('https://test.de');
        $domain->setHreflangUseOnlyLocale(false);
        $domain->setLanguageId($languageId);

        $this->salesChannelContext->getSalesChannel()->getDomains()->add($domain);

        $this->seoUrlRepository->create([
            [
                'id' => Uuid::randomHex(),
                'salesChannelId' => $this->salesChannelContext->getSalesChannel()->getId(),
                
$this->cacheWarmer = new CacheWarmer(
            $this->salesChannelDomainRepositoryMock,
            $this->busMock,
            $this->registryMock,
            $this->cacheIdLoader
        );
    }

    public function testWarmUpNoId(): void
    {
        $salesChannelDomain = new SalesChannelDomainEntity();
        $salesChannelDomain->setId(Uuid::randomHex());
        $salesChannelDomain->setUniqueIdentifier(Uuid::randomHex());
        $salesChannelDomain->setUrl('https://localhost');
        $context = Context::createDefaultContext();
        $criteria = new Criteria();
        $cacheId = Uuid::randomHex();
        $this->cacheIdLoader->expects(static::once())->method('load')->willReturn($cacheId);

        $warmUpMessage = new WarmUpMessage('/testRoute', []);
        $warmUpMessageExpected = new WarmUpMessage('/testRoute', []);
        $warmUpMessageExpected->setCacheId($cacheId);
        
$controller->switchLanguage(
            new Request([]['languageId' => $notExistingLang]),
            $this->createMock(SalesChannelContext::class)
        );
    }

    public function testSwitchCustomerChange(): void
    {
        $language = new LanguageEntity();
        $language->setUniqueIdentifier(Uuid::randomHex());
        $scDomain = new SalesChannelDomainEntity();
        $scDomain->setUniqueIdentifier(Uuid::randomHex());
        $scDomain->setUrl('http://localhost');
        $language->setSalesChannelDomains(new SalesChannelDomainCollection([$scDomain]));

        $changeLangMock = $this->createMock(AbstractChangeLanguageRoute::class);

        $routerMock = $this->createMock(RouterInterface::class);
        $routerMock->expects(static::once())->method('getContext')->willReturn(new RequestContext());
        $routerMock->expects(static::once())->method('generate')->willReturn('http://localhost');
        $requestStackMock = $this->createMock(RequestStack::class);
        $requestStackMock->expects(static::exactly(2))->method('getMainRequest')->willReturn(new Request());

        
$contextFactory = $this->getContainer()->get(SalesChannelContextFactory::class);
        $this->salesChannelContext = $contextFactory->create('', TestDefaults::SALES_CHANNEL);
    }

    public function testGetHomeUrlSalesChannelIsExistingTwoDomain(): void
    {
        $criteria = new Criteria();
        $criteria->addAssociation('locale');
        $languages = $this->getContainer()->get('language.repository')->search($criteria$this->salesChannelContext->getContext())->getEntities();

        $domain = new SalesChannelDomainEntity();
        $domain->setId(Uuid::randomHex());
        $domain->setUrl('https://test-sitemap.de');
        $domain->setHreflangUseOnlyLocale(false);
        $domain->setLanguageId($languages->first()->getId());

        $this->salesChannelContext->getSalesChannel()->getDomains()->add($domain);

        $domain = new SalesChannelDomainEntity();
        $domain->setId(Uuid::randomHex());
        $domain->setUrl('https://test-sitemap.de/en');
        $domain->setHreflangUseOnlyLocale(false);
        
Home | Imprint | This part of the site doesn't use cookies.