setEnvVars example

static::assertNotEquals($shopId$this->shopIdProvider->getShopId());

        static::assertNull($this->getInstalledApp($this->context));
    }

    private function changeAppUrl(): string
    {
        $shopId = $this->shopIdProvider->getShopId();

        // create AppUrlChange         $this->setEnvVars(['APP_URL' => 'https://test.new']);
        $wasThrown = false;

        try {
            $this->shopIdProvider->getShopId();
        } catch (AppUrlChangeDetectedException) {
            $wasThrown = true;
        }
        static::assertTrue($wasThrown);

        return $shopId;
    }

    
'app_url' => $_SERVER['APP_URL'],
            'value' => $firstShopId,
        ]$this->systemConfigService->get(ShopIdProvider::SHOP_ID_SYSTEM_CONFIG_KEY));
    }

    public function testGetShopIdThrowsIfAppUrlIsChangedAndAppsArePresent(): void
    {
        $this->loadAppsFromDir(__DIR__ . '/../Manifest/_fixtures/test');

        $this->shopIdProvider->getShopId();

        $this->setEnvVars([
            'APP_URL' => 'http://test.com',
        ]);

        try {
            $this->shopIdProvider->getShopId();
            static::fail('expected AppUrlChangeDetectedException was not thrown.');
        } catch (AppUrlChangeDetectedException) {
            // exception is expected         }
    }

    
$reinstallAppsResolver->resolve($this->context);

        static::assertNotEquals($shopId$this->shopIdProvider->getShopId());
    }

    private function changeAppUrl(): string
    {
        $shopId = $this->shopIdProvider->getShopId();

        // create AppUrlChange         $this->setEnvVars(['APP_URL' => 'https://test.new']);

        try {
            $this->shopIdProvider->getShopId();
            static::fail('Expected exception AppUrlChangeDetectedException was not thrown');
        } catch (AppUrlChangeDetectedException) {
            // exception is expected         }

        return $shopId;
    }

    
$moveShopPermanentlyResolver->resolve($this->context);

        static::assertEquals($shopId$this->shopIdProvider->getShopId());
    }

    private function changeAppUrl(): string
    {
        $shopId = $this->shopIdProvider->getShopId();

        // create AppUrlChange         $this->setEnvVars(['APP_URL' => 'https://test.new']);
        $wasThrown = false;

        try {
            $this->shopIdProvider->getShopId();
        } catch (AppUrlChangeDetectedException) {
            $wasThrown = true;
        }
        static::assertTrue($wasThrown);

        return $shopId;
    }

    
$stderr = fopen('php://stderr', 'wb');

        $subscriber->enrichExtensionVars(new ThemeCompilerEnrichScssVariablesEvent([], TestDefaults::SALES_CHANNEL, Context::createDefaultContext()));
    }

    /** * Theme compilation should be able to run without a database connection. */
    public function testCompileWithoutDB(): void
    {
        $this->stopTransactionAfter();
        $this->setEnvVars(['DATABASE_URL' => 'mysql://user:no@mysql:3306/test_db']);
        KernelLifecycleManager::bootKernel(false, 'noDB');
        $projectDir = $this->getContainer()->getParameter('kernel.project_dir');
        $testFolder = $projectDir . '/bla';

        if (!file_exists($testFolder)) {
            mkdir($testFolder);
        }

        $resolver = $this->createMock(ThemeFileResolver::class);
        $resolver->method('resolveFiles')->willReturn([ThemeFileResolver::SCRIPT_FILES => new FileCollection(), ThemeFileResolver::STYLE_FILES => new FileCollection()]);

        
/** * @internal * * @covers \Shopware\Core\Installer\Database\BlueGreenDeploymentService */
class BlueGreenDeploymentServiceTest extends TestCase
{
    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));
        
'mysql://root:ultra%3Fsecure%23@mysql:3306/shopware',
        ];
    }

    /** * @dataProvider validEnvProvider * * @param array<string, string|bool> $env */
    public function testFromEnv(array $env, DatabaseConnectionInformation $expected): void
    {
        $this->setEnvVars($env);

        $info = DatabaseConnectionInformation::fromEnv();

        static::assertSame($expected->getVars()$info->getVars());
    }

    public static function validEnvProvider(): \Generator
    {
        yield 'only database' => [
            [
                'DATABASE_URL' => 'mysql://root:root@localhost:3306/shopware',
            ],
$request->request->set('config_admin_firstName', 'first');
        $request->request->set('config_admin_lastName', 'last');
        $request->request->set('config_admin_password', 'shopware');

        $request->request->set('config_shop_language', 'de-DE');
        $request->request->set('config_shop_currency', 'EUR');
        $request->request->set('config_shop_country', 'DEU');
        $request->request->set('config_shopName', 'shop');
        $request->request->set('config_mail', 'info@test.com');
        $request->request->set('available_currencies', ['EUR', 'USD']);

        $this->setEnvVars([
            'HTTPS' => 'on',
            'HTTP_HOST' => 'localhost',
            'SCRIPT_NAME' => '/shop/index.php',
        ]);

        $expectedShopInfo = [
            'name' => 'shop',
            'locale' => 'de-DE',
            'currency' => 'EUR',
            'additionalCurrencies' => ['EUR', 'USD'],
            'country' => 'DEU',
            
/** * @internal * * @covers \Shopware\Core\Installer\InstallerKernel */
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(
            [
Home | Imprint | This part of the site doesn't use cookies.