ThemeConfigChangedEvent example

$this->cachedResolvedConfigLoaderInvalidator->assigned($event);

        static::assertEquals(
            $expectedInvalidatedTags,
            $this->cacheInvalidator->getInvalidatedTags()
        );
    }

    public function testInvalidate(): void
    {
        $themeId = Uuid::randomHex();
        $event = new ThemeConfigChangedEvent($themeId['test' => 'test']);

        $expectedInvalidatedTags = [
            'theme-config-' . $themeId,
            'theme.test',
        ];

        $this->cachedResolvedConfigLoaderInvalidator->invalidate($event);

        static::assertEquals(
            $expectedInvalidatedTags,
            $this->cacheInvalidator->getInvalidatedTags()
        );
if ($config) {
            foreach ($config as $key => $value) {
                $data['configValues'][$key] = $value;
            }
        }

        if ($parentThemeId) {
            $data['parentThemeId'] = $parentThemeId;
        }

        if (\array_key_exists('configValues', $data)) {
            $this->dispatcher->dispatch(new ThemeConfigChangedEvent($themeId$data['configValues']));
        }

        if (\array_key_exists('configValues', $data) && $theme->getConfigValues()) {
            $submittedChanges = $data['configValues'];
            $currentConfig = $theme->getConfigValues();
            $data['configValues'] = array_replace_recursive($currentConfig$data['configValues']);

            foreach ($submittedChanges as $key => $changes) {
                if (isset($changes['value']) && \is_array($changes['value']) && isset($currentConfig[(string) $key]) && \is_array($currentConfig[(string) $key])) {
                    $data['configValues'][$key]['value'] = array_unique($changes['value']);
                }
            }

                        ),
                    ]
                ),
                null,
                new Criteria(),
                $this->context
            )
        );

        $this->eventDispatcherMock->expects(static::once())->method('dispatch')->with(
            new ThemeConfigChangedEvent($themeId['test' => ['value' => ['test']]])
        );

        $this->themeCompilerMock->expects(static::exactly(2))->method('compileTheme');

        $this->themeService->updateTheme($themeId['test' => ['value' => ['test']]]$parentThemeId$this->context);
    }

    public function testUpdateThemeNoSalesChannelAssigned(): void
    {
        $themeId = Uuid::randomHex();

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