createSalesChannels example

$this->deLanguageId = $this->getDeDeLanguageId();
    }

    /** * @dataProvider domainProvider * * @param array<string, string|array<string, string>> $salesChannels * @param ExpectedRequest[] $requests */
    public function testDomainResolving(array $salesChannels, array $requests): void
    {
        $this->createSalesChannels($salesChannels);

        $snippetSetEN = $this->getSnippetSetIdForLocale(self::LOCALE_EN_GB_ISO);
        $snippetSetDE = $this->getSnippetSetIdForLocale(self::LOCALE_DE_DE_ISO);

        foreach ($requests as $expectedRequest) {
            if ($expectedRequest->exception) {
                $exception = $expectedRequest->exception;

                $this->expectException($exception);
            }

            
private array $languages;

    protected function setUp(): void
    {
        $this->connection = $this->getContainer()
            ->get(Connection::class);

        $this->cleanUpSalesChannels();

        $this->languages = $this->fetchLanguages();

        $this->createSalesChannels();
        $this->createUserForEachLanguage();
    }

    public function testMigrationCopiesSalesChannelIdsIntoUserConfig(): void
    {
        $migration = $this->getMigration();
        $migration->update($this->connection);

        $expectedIds = $this->fetchExpectedSalesChannelIds(array_values($this->languages));
        $configs = $this->fetchConfigs();

        
'domains' => [
                [
                    'id' => Uuid::randomHex(),
                    'url' => ($case->https ? 'https://' : 'http://') . $case->host . $request->getBaseUrl() . $case->salesChannelPrefix,
                    'languageId' => Defaults::LANGUAGE_SYSTEM,
                    'currencyId' => Defaults::CURRENCY,
                    'snippetSetId' => $this->getSnippetSetIdForLocale('en-GB'),
                ],
            ],
        ];

        return $this->createSalesChannels([$salesChannel]);
    }

    private function createSalesChannels(array $salesChannels): SalesChannelContext
    {
        $salesChannels = array_map(function D$salesChannelData) {
            $defaults = [
                'typeId' => Defaults::SALES_CHANNEL_TYPE_STOREFRONT,
                'accessKey' => AccessKeyHelper::generateAccessKey('sales-channel'),
                'languageId' => Defaults::LANGUAGE_SYSTEM,
                'snippetSetId' => $this->getSnippetSetIdForLocale('en-GB'),
                'currencyId' => Defaults::CURRENCY,
                
Home | Imprint | This part of the site doesn't use cookies.