UpdatePreFinishEvent example

/** * @internal * * @covers \Shopware\Core\Framework\Update\Event\UpdatePreFinishEvent * @covers \Shopware\Core\Framework\Update\Event\UpdateEvent */
class UpdatePreFinishEventTest extends TestCase
{
    public function testGetters(): void
    {
        $context = Context::createDefaultContext();
        $event = new UpdatePreFinishEvent($context, 'oldVersion', 'newVersion');

        static::assertSame('oldVersion', $event->getOldVersion());
        static::assertSame('newVersion', $event->getNewVersion());
        static::assertSame($context$event->getContext());
    }
}
$context = Context::createDefaultContext();
            $systemConfigService = $this->container->get(SystemConfigService::class);
            $oldVersion = $systemConfigService->getString(UpdateController::UPDATE_PREVIOUS_VERSION_KEY);

            $newVersion = $containerWithoutPlugins->getParameter('kernel.shopware_version');
            if (!\is_string($newVersion)) {
                throw new \RuntimeException('Container parameter "kernel.shopware_version" needs to be a string');
            }

            /** @var EventDispatcherInterface $eventDispatcherWithoutPlugins */
            $eventDispatcherWithoutPlugins = $this->rebootKernelWithoutPlugins()->get('event_dispatcher');
            $eventDispatcherWithoutPlugins->dispatch(new UpdatePreFinishEvent($context$oldVersion$newVersion));

            $this->runMigrations($output);
        } finally {
            $kernel->reboot(null, $pluginLoader);
        }

        if ($input->getOption('skip-asset-build')) {
            $context->addState(PluginLifecycleService::STATE_SKIP_ASSET_BUILDING);
        }

        /** @var EventDispatcherInterface $eventDispatcher */
        
Home | Imprint | This part of the site doesn't use cookies.