ThemeEntity example

$themeProvider = new DatabaseAvailableThemeProvider($salesChannelRepository);

        static::assertEquals([]$themeProvider->load(Context::createDefaultContext(), true));
    }

    public function testThemeProviderReturnsIdsOfFoundSalesChannelsWithThemes(): void
    {
        $salesChannel = new SalesChannelEntity();
        $salesChannel->setId('sales-channel-with-theme');
        $salesChannel->setUniqueIdentifier('sales-channel-with-theme');

        $theme = new ThemeEntity();
        $theme->setId('associated-theme');
        $theme->setUniqueIdentifier('associated-theme');

        $salesChannel->addExtension('themes', new ThemeCollection([$theme]));

        $themeProvider = new DatabaseAvailableThemeProvider(new StaticEntityRepository([
            new SalesChannelCollection([$salesChannel]),
        ]));

        static::assertEquals(
            ['sales-channel-with-theme' => 'associated-theme'],
            
public function testUpdateThemeNoTheme(): void
    {
        $themeId = Uuid::randomHex();

        $this->themeRepositoryMock->method('search')->willReturn(
            new EntitySearchResult(
                'theme',
                1,
                new ThemeCollection(
                    [
                        (new ThemeEntity())->assign(
                            [
                                '_uniqueIdentifier' => 'no',
                                'salesChannels' => new SalesChannelCollection(),
                            ]
                        ),
                    ]
                ),
                null,
                new Criteria(),
                $this->context
            )
        );
Home | Imprint | This part of the site doesn't use cookies.