Skip to content

Commit

Permalink
[#1422] Renamed ENVIRONMENT_TEST to ENVIRONMENT_STAGE.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Oct 16, 2024
1 parent 317656b commit 1bf0239
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .vortex/docs/content/drupal/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Available constants include:
- `ENVIRONMENT_LOCAL`
- `ENVIRONMENT_CI`
- `ENVIRONMENT_PROD`
- `ENVIRONMENT_TEST`
- `ENVIRONMENT_STAGE`
- `ENVIRONMENT_DEV`

These are later used to set `$settings['environment']` variable, which can be
Expand Down
30 changes: 18 additions & 12 deletions tests/phpunit/Drupal/EnvironmentSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ public function dataProviderEnvironmentTypeResolution(): array {
],
static::ENVIRONMENT_PROD,
],
[
[
'AH_SITE_ENVIRONMENT' => 'stage',
],
static::ENVIRONMENT_STAGE,
],
[
[
'AH_SITE_ENVIRONMENT' => 'test',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],
[
[
Expand Down Expand Up @@ -123,7 +129,7 @@ public function dataProviderEnvironmentTypeResolution(): array {
'VORTEX_LAGOON_PRODUCTION_BRANCH' => 'master',
'LAGOON_ENVIRONMENT_TYPE' => 'development',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],
[
[
Expand All @@ -132,7 +138,7 @@ public function dataProviderEnvironmentTypeResolution(): array {
'VORTEX_LAGOON_PRODUCTION_BRANCH' => FALSE,
'LAGOON_ENVIRONMENT_TYPE' => 'development',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],
[
[
Expand All @@ -150,7 +156,7 @@ public function dataProviderEnvironmentTypeResolution(): array {
'VORTEX_LAGOON_PRODUCTION_BRANCH' => FALSE,
'LAGOON_ENVIRONMENT_TYPE' => 'development',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],
[
[
Expand All @@ -176,7 +182,7 @@ public function dataProviderEnvironmentTypeResolution(): array {
'LAGOON_ENVIRONMENT_TYPE' => 'development',
'LAGOON_GIT_BRANCH' => 'release/1.2.3',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],
[
[
Expand All @@ -192,7 +198,7 @@ public function dataProviderEnvironmentTypeResolution(): array {
'LAGOON_ENVIRONMENT_TYPE' => 'development',
'LAGOON_GIT_BRANCH' => 'hotfix/1.2.3',
],
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
],

[
Expand Down Expand Up @@ -498,9 +504,9 @@ public function testEnvironmentAcquiaDev(): void {
/**
* Test per-environment settings for Test environment.
*/
public function testEnvironmentAcquiaTest(): void {
public function testEnvironmentAcquiaStage(): void {
$this->setEnvVars([
'AH_SITE_ENVIRONMENT' => 'test',
'AH_SITE_ENVIRONMENT' => 'stage',
]);

$this->requireSettingsFile();
Expand All @@ -509,7 +515,7 @@ public function testEnvironmentAcquiaTest(): void {
$config['config_split.config_split.test']['status'] = TRUE;
$config['environment_indicator.indicator']['bg_color'] = '#fff176';
$config['environment_indicator.indicator']['fg_color'] = '#000000';
$config['environment_indicator.indicator']['name'] = static::ENVIRONMENT_TEST;
$config['environment_indicator.indicator']['name'] = static::ENVIRONMENT_STAGE;
$config['environment_indicator.settings']['favicon'] = TRUE;
$config['environment_indicator.settings']['toolbar_integration'] = [TRUE];
$config['maintenance_theme'] = 'your_site_theme';
Expand All @@ -523,7 +529,7 @@ public function testEnvironmentAcquiaTest(): void {
$settings['config_sync_directory'] = static::CONFIG_PATH_TESTING;
$settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml';
$settings['entity_update_batch_size'] = 50;
$settings['environment'] = static::ENVIRONMENT_TEST;
$settings['environment'] = static::ENVIRONMENT_STAGE;
$settings['file_private_path'] = static::PRIVATE_PATH_TESTING;
$settings['file_scan_ignore_directories'] = [
'node_modules',
Expand Down Expand Up @@ -700,7 +706,7 @@ public function testEnvironmentLagoonTest(): void {
$config['config_split.config_split.test']['status'] = TRUE;
$config['environment_indicator.indicator']['bg_color'] = '#fff176';
$config['environment_indicator.indicator']['fg_color'] = '#000000';
$config['environment_indicator.indicator']['name'] = static::ENVIRONMENT_TEST;
$config['environment_indicator.indicator']['name'] = static::ENVIRONMENT_STAGE;
$config['environment_indicator.settings']['favicon'] = TRUE;
$config['environment_indicator.settings']['toolbar_integration'] = [TRUE];
$config['maintenance_theme'] = 'your_site_theme';
Expand All @@ -715,7 +721,7 @@ public function testEnvironmentLagoonTest(): void {
$settings['config_sync_directory'] = static::CONFIG_PATH_TESTING;
$settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml';
$settings['entity_update_batch_size'] = 50;
$settings['environment'] = static::ENVIRONMENT_TEST;
$settings['environment'] = static::ENVIRONMENT_STAGE;
$settings['file_private_path'] = static::PRIVATE_PATH_TESTING;
$settings['file_scan_ignore_directories'] = [
'node_modules',
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/Drupal/SettingsTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ abstract class SettingsTestCase extends TestCase {
final const ENVIRONMENT_PROD = 'prod';

/**
* Defines a constant for the name of the 'test' environment.
* Defines a constant for the name of the 'stage' environment.
*/
final const ENVIRONMENT_TEST = 'test';
final const ENVIRONMENT_STAGE = 'stage';

/**
* Defines a constant for the name of the 'dev' environment.
Expand Down
10 changes: 5 additions & 5 deletions tests/phpunit/Drupal/SwitchableSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static function dataProviderConfigSplit(): array {
],
],
[
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
[
'config_split.config_split.test' => ['status' => TRUE],
],
Expand Down Expand Up @@ -204,9 +204,9 @@ public static function dataProviderEnvironmentIndicator(): array {
],
],
[
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
[
'environment_indicator.indicator' => ['name' => static::ENVIRONMENT_TEST, 'bg_color' => '#fff176', 'fg_color' => '#000000'],
'environment_indicator.indicator' => ['name' => static::ENVIRONMENT_STAGE, 'bg_color' => '#fff176', 'fg_color' => '#000000'],
'environment_indicator.settings' => ['toolbar_integration' => [TRUE], 'favicon' => TRUE],
],
],
Expand Down Expand Up @@ -353,7 +353,7 @@ public static function dataProviderShield(): array {
],

[
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
[
'DRUPAL_SHIELD_USER' => 'drupal_shield_user',
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass',
Expand Down Expand Up @@ -481,7 +481,7 @@ public static function dataProviderStageFileProxy(): array {
],

[
static::ENVIRONMENT_TEST,
static::ENVIRONMENT_STAGE,
[
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/',
'DRUPAL_SHIELD_USER' => 'drupal_shield_user',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
declare(strict_types=1);

switch ($settings['environment']) {
case ENVIRONMENT_TEST:
case ENVIRONMENT_STAGE:
$config['config_split.config_split.test']['status'] = TRUE;
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$config['environment_indicator.indicator']['fg_color'] = '#000000';
break;

case ENVIRONMENT_TEST:
case ENVIRONMENT_STAGE:
$config['environment_indicator.indicator']['bg_color'] = '#fff176';
$config['environment_indicator.indicator']['fg_color'] = '#000000';
break;
Expand Down
3 changes: 2 additions & 1 deletion web/sites/default/includes/providers/settings.acquia.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
$settings['environment'] = ENVIRONMENT_PROD;
break;

case 'stage':
case 'test':
$settings['environment'] = ENVIRONMENT_TEST;
$settings['environment'] = ENVIRONMENT_STAGE;
break;
}
}
4 changes: 2 additions & 2 deletions web/sites/default/includes/providers/settings.lagoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
}
// Dedicated test environment based on a branch name.
elseif (getenv('LAGOON_GIT_BRANCH') == 'main' || getenv('LAGOON_GIT_BRANCH') == 'master') {
$settings['environment'] = ENVIRONMENT_TEST;
$settings['environment'] = ENVIRONMENT_STAGE;
}
// Test environment based on a branch prefix for release and
// hotfix branches.
elseif (!empty(getenv('LAGOON_GIT_BRANCH')) && (str_starts_with(getenv('LAGOON_GIT_BRANCH'), 'release/') || str_starts_with(getenv('LAGOON_GIT_BRANCH'), 'hotfix/'))) {
$settings['environment'] = ENVIRONMENT_TEST;
$settings['environment'] = ENVIRONMENT_STAGE;
}
}

Expand Down
4 changes: 2 additions & 2 deletions web/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
if (!defined('ENVIRONMENT_PROD')) {
define('ENVIRONMENT_PROD', 'prod');
}
if (!defined('ENVIRONMENT_TEST')) {
define('ENVIRONMENT_TEST', 'test');
if (!defined('ENVIRONMENT_STAGE')) {
define('ENVIRONMENT_STAGE', 'stage');
}
if (!defined('ENVIRONMENT_DEV')) {
define('ENVIRONMENT_DEV', 'dev');
Expand Down

1 comment on commit 1bf0239

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.