getInstallerContainer example

'@Installer/installer/requirements.html.twig',
                array_merge($this->getDefaultViewParams()[
                    'requirementChecks' => $checks,
                ])
            )
            ->willReturn('checks');

        $jwtCertificateGenerator = $this->createMock(JwtCertificateGenerator::class);
        $jwtCertificateGenerator->expects(static::never())->method('generate');

        $controller = new RequirementsController([$validator]$jwtCertificateGenerator, __DIR__);
        $controller->setContainer($this->getInstallerContainer($twig));

        $response = $controller->requirements($request);
        static::assertSame('checks', $response->getContent());
    }

    public function testRequirementsRouteRedirectsOnPostWhenChecksPass(): void
    {
        $request = new Request();
        $request->setMethod('POST');

        $checks = new RequirementsCheckCollection([new PathCheck('check', RequirementCheck::STATUS_SUCCESS)]);

        
$this->connectionFactory = $this->createMock(DatabaseConnectionFactory::class);
        $this->router = $this->createMock(RouterInterface::class);

        $this->controller = new DatabaseConfigurationController(
            $this->translator,
            $this->blueGreenDeploymentService,
            $this->jwtCertificateGenerator,
            $this->setupDatabaseAdapter,
            $this->connectionFactory,
            __DIR__
        );
        $this->controller->setContainer($this->getInstallerContainer($this->twig, ['router' => $this->router]));
    }

    public function testDatabaseGetConfigurationRoute(): void
    {
        $this->twig->expects(static::once())->method('render')
            ->with(
                '@Installer/installer/database-configuration.html.twig',
                array_merge($this->getDefaultViewParams()[
                    'connectionInfo' => new DatabaseConnectionInformation(),
                    'error' => null,
                ])
            )
$this->translator = $this->createMock(TranslatorInterface::class);

        $this->controller = new ShopConfigurationController(
            $connectionFactory,
            $this->envConfigWriter,
            $this->shopConfigService,
            $this->adminConfigService,
            $this->translator,
            ['de' => 'de-DE', 'en' => 'en-GB'],
            ['EUR', 'USD']
        );
        $this->controller->setContainer($this->getInstallerContainer($this->twig, ['router' => $this->router]));
    }

    public function testGetConfigurationRoute(): void
    {
        $request = new Request();
        $session = new Session(new MockArraySessionStorage());
        $session->set(DatabaseConnectionInformation::classnew DatabaseConnectionInformation());
        $session->set(BlueGreenDeploymentService::ENV_NAME, true);
        $request->setMethod('GET');
        $request->setSession($session);
        $request->attributes->set('_locale', 'de');

        
$twig->expects(static::once())->method('render')
            ->with(
                '@Installer/installer/license.html.twig',
                array_merge($this->getDefaultViewParams()[
                    'licenseAgreement' => 'licenseText',
                    'error' => null,
                ]),
            )
            ->willReturn('license');

        $controller = new LicenseController($licenseFetcher);
        $controller->setContainer($this->getInstallerContainer($twig));

        $response = $controller->license($request);
        static::assertSame('license', $response->getContent());
    }

    public function testLicenseRouteRendersErrorIfLicenseCanNotBeFetched(): void
    {
        $request = new Request();
        $request->setMethod('GET');

        $licenseFetcher = $this->createMock(LicenseFetcher::class);
        

        $twig = $this->createMock(Environment::class);
        $twig->expects(static::once())->method('render')
            ->with('@Installer/installer/language-selection.html.twig', $this->getDefaultViewParams())
            ->willReturn('languages');

        $notifier = $this->createMock(Notifier::class);
        $notifier->expects(static::once())->method('doTrackEvent')
            ->with(Notifier::EVENT_INSTALL_STARTED);

        $controller = new SelectLanguagesController($notifier);
        $controller->setContainer($this->getInstallerContainer($twig));

        $response = $controller->languageSelection();
        static::assertSame('languages', $response->getContent());
    }
}
protected function setUp(): void
    {
        $this->connectionFactory = $this->createMock(DatabaseConnectionFactory::class);
        $this->databaseMigrator = $this->createMock(DatabaseMigrator::class);
        $this->twig = $this->createMock(Environment::class);
        $this->router = $this->createMock(RouterInterface::class);

        $this->controller = new DatabaseImportController(
            $this->connectionFactory,
            $this->databaseMigrator
        );
        $this->controller->setContainer($this->getInstallerContainer($this->twig, ['router' => $this->router]));
    }

    /** * @after */
    public function unsetEnvVars(): void
    {
        unset(
            $_SERVER[BlueGreenDeploymentService::ENV_NAME],
            $_ENV[BlueGreenDeploymentService::ENV_NAME],
            $_SERVER[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE],
            
Home | Imprint | This part of the site doesn't use cookies.