ThemeService example

public function getCharset(): string
            {
                return $this->kernel->getCharset();
            }

            public function __call($name$arguments) /* @phpstan-ignore-line */
            {
                return $this->kernel->$name(...\func_get_args()); /* @phpstan-ignore-line */
            }
        };

        $themeService = new ThemeService(
            new StorefrontPluginRegistry(
                $kernel,
                $this->getContainer()->get(StorefrontPluginConfigurationFactory::class),
                $this->getContainer()->get(ActiveAppsLoader::class)
            ),
            $this->getContainer()->get('theme.repository'),
            $this->getContainer()->get('theme_sales_channel.repository'),
            $themeCompilerMock,
            $this->getContainer()->get('event_dispatcher'),
            new DatabaseConfigLoader(
                $this->getContainer()->get('theme.repository'),
                
protected function setUp(): void
    {
        $this->connectionMock = $this->createMock(Connection::class);
        $this->storefrontPluginRegistryMock = $this->createMock(StorefrontPluginRegistry::class);
        $this->themeRepositoryMock = $this->createMock(EntityRepository::class);
        $this->themeSalesChannelRepositoryMock = $this->createMock(EntityRepository::class);
        $this->themeCompilerMock = $this->createMock(ThemeCompiler::class);
        $this->eventDispatcherMock = $this->createMock(EventDispatcher::class);
        $databaseConfigLoaderMock = $this->createMock(DatabaseConfigLoader::class);
        $this->context = Context::createDefaultContext();

        $this->themeService = new ThemeService(
            $this->storefrontPluginRegistryMock,
            $this->themeRepositoryMock,
            $this->themeSalesChannelRepositoryMock,
            $this->themeCompilerMock,
            $this->eventDispatcherMock,
            $databaseConfigLoaderMock,
            $this->connectionMock
        );
    }

    public function testAssignTheme(): void
    {
$shopwareContainer = $c['shopware.container'];

            /* @var Installer $themeInstaller */
            return $shopwareContainer->get('theme_installer');
        };

        $container['http-client'] = function D$c) {
            return new CurlClient();
        };

        $container['theme.service'] = function D$c) {
            return new ThemeService(
                $c['db'],
                $c['shopware.theme_installer']
            );
        };

        $container['install.requirements'] = function D$c) {
            return new Requirements(SW_PATH . '/engine/Shopware/Components/Check/Data/System.xml', $c['translation.service']);
        };

        $container['install.requirementsPath'] = function D$c) {
            $check = new RequirementsPath(SW_PATH, SW_PATH . '/engine/Shopware/Components/Check/Data/Path.xml');
            
Home | Imprint | This part of the site doesn't use cookies.