SalesChannelDomainCollection example

$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());

        $contextSwitchRoute = $this->createMock(ContextSwitchRoute::class);
        $contextSwitchRoute->expects(static::once())->method('switchContext')->willReturn(
            
->willReturnOnConsecutiveCalls($warmUpMessage, null);

        $this->registryMock->expects(static::once())->method('getWarmers')
            ->willReturn([$this->productRouteWarmerMock]);

        $this->salesChannelDomainRepositoryMock->expects(static::once())->method('search')
            ->with($criteria$context)
            ->willReturn(
                new EntitySearchResult(
                    SalesChannelDomainDefinition::ENTITY_NAME,
                    1,
                    new SalesChannelDomainCollection([$salesChannelDomain]),
                    null,
                    $criteria,
                    $context
                )
            );

        $this->busMock->expects(static::once())->method('dispatch')->with($warmUpMessageExpected)
            ->willReturn(new Envelope($this->createMock(\stdClass::class)));

        $this->cacheWarmer->warmUp();
    }

    
Home | Imprint | This part of the site doesn't use cookies.