BeforeSystemConfigChangedEvent example


            );

        $toBeDeleted = [];
        $insertQueue = new MultiInsertQueryQueue($this->connection, 100, false, true);
        $events = [];

        foreach ($values as $key => $value) {
            $key = trim($key);
            $this->validate($key$salesChannelId);

            $event = new BeforeSystemConfigChangedEvent($key$value$salesChannelId);
            $this->eventDispatcher->dispatch($event);

            // Use modified value provided by potential event subscribers.             $value = $event->getValue();

            // On null value, delete the config             if ($value === null) {
                $toBeDeleted[] = $key;

                $events[] = new SystemConfigChangedEvent($key$value$salesChannelId);

                
$event = $this->createMock(EntityDeleteEvent::class);
        $event
            ->method('getIds')
            ->with(CmsPageDefinition::ENTITY_NAME)
            ->willReturn($cmsPageIds);

        return $event;
    }

    private static function getBeforeSystemConfigChangedEvent(string $key, mixed $value): BeforeSystemConfigChangedEvent
    {
        return new BeforeSystemConfigChangedEvent($key$value, null);
    }

    /** * @param array<array{method: string, with: array<mixed>, willReturn: mixed}> $configurations */
    private function getConnectionMock(array $configurations = []): Connection
    {
        $connection = $this->createMock(Connection::class);

        foreach ($configurations as $config) {
            $connection
                
Home | Imprint | This part of the site doesn't use cookies.