setEnvironmentVariable example

use EnvTestBehaviour;

    public function testSetsEnvironmentVariableToTrueIfTriggersCanBeCreated(): void
    {
        $this->setEnvVars([BlueGreenDeploymentService::ENV_NAME => '0']);

        $connection = $this->createMock(Connection::class);
        $connection->expects(static::exactly(3))->method('executeQuery');

        $service = new BlueGreenDeploymentService();
        $session = new Session(new MockArraySessionStorage());
        $service->setEnvironmentVariable($connection$session);

        static::assertTrue($_ENV[BlueGreenDeploymentService::ENV_NAME]);
        static::assertTrue($_SERVER[BlueGreenDeploymentService::ENV_NAME]);
        static::assertTrue(EnvironmentHelper::getVariable(BlueGreenDeploymentService::ENV_NAME));
        static::assertTrue($session->get(BlueGreenDeploymentService::ENV_NAME));
    }

    public function testSetsEnvironmentVariableToFalseIfTriggersCanNotBeCreated(): void
    {
        $this->setEnvVars([BlueGreenDeploymentService::ENV_NAME => '1']);

        


                $connection = $this->connectionFactory->getConnection($connectionInfo, true);

                $this->setupDatabaseAdapter->createDatabase($connection$connectionInfo->getDatabaseName());

                $connection = $this->connectionFactory->getConnection($connectionInfo);
            }

            $session->set(DatabaseConnectionInformation::class$connectionInfo);

            $this->blueGreenDeploymentService->setEnvironmentVariable($connection$session);

            if ($this->setupDatabaseAdapter->getTableCount($connection$connectionInfo->getDatabaseName())) {
                $connectionInfo->setDatabaseName('');

                return $this->renderInstaller('@Installer/installer/database-configuration.html.twig', [
                    'connectionInfo' => $connectionInfo,
                    'error' => $this->translator->trans('shopware.installer.database-configuration_non_empty_database'),
                ]);
            }

            $this->jwtCertificateGenerator->generate(
                
Home | Imprint | This part of the site doesn't use cookies.