InstallerKernel example


class InstallerKernelTest extends TestCase
{
    use EnvTestBehaviour;

    public function testItCorrectlyConfiguresTheContainer(): void
    {
        $this->setEnvVars(['COMPOSER_HOME' => null]);

        $kernel = new InstallerKernel('test', false);

        $kernel->boot();

        static::assertTrue($kernel->getContainer()->hasParameter('kernel.shopware_version'));

        // the default revision changes per commit, if it is set we expect that it is correct         static::assertTrue($kernel->getContainer()->hasParameter('kernel.shopware_version_revision'));

        static::assertEquals(
            [
                'FrameworkBundle' => FrameworkBundle::class,
                
explode(',', $trustedProxies),
            Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
        );
    }

    $trustedHosts = $context['TRUSTED_HOSTS'] ?? false;
    if ($trustedHosts) {
        Request::setTrustedHosts(explode(',', $trustedHosts));
    }

    if (!file_exists(dirname(__DIR__) . '/install.lock')) {
        return new InstallerKernel($appEnv$debug);
    }

    $shopwareHttpKernel = new HttpKernel($appEnv$debug$classLoader);

    return new class($shopwareHttpKernel) implements HttpKernelInterface, TerminableInterface {
        private HttpKernel $httpKernel;

        public function __construct(HttpKernel $httpKernel)
        {
            $this->httpKernel = $httpKernel;
        }

        
 else {
            readfile(__DIR__ . '/recovery/update/maintenance.html');
        }

        exit;
    }

    $appEnv = $context['APP_ENV'] ?? 'dev';
    $debug = (bool) ($context['APP_DEBUG'] ?? ($appEnv !== 'prod'));

    if (!file_exists(dirname(__DIR__) . '/install.lock')) {
        return new InstallerKernel($appEnv$debug);
    }

    $shopwareHttpKernel = new HttpKernel($appEnv$debug$classLoader);

    if (EnvironmentHelper::getVariable('COMPOSER_PLUGIN_LOADER', false)) {
        $shopwareHttpKernel->setPluginLoader(
            new ComposerPluginLoader($classLoader, null)
        );
    }

    return new class($shopwareHttpKernel) implements HttpKernelInterface, TerminableInterface {
        
Home | Imprint | This part of the site doesn't use cookies.