-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f02399
commit 638f01a
Showing
2 changed files
with
1 addition
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,150 +15,6 @@ | |
*/ | ||
class SwitchableSettingsTest extends SettingsTestCase { | ||
|
||
/** | ||
* Test ClamAV configs in Daemon mode with defaults. | ||
*/ | ||
public function testClamavDaemonCustom(): void { | ||
$this->setEnvVars([ | ||
'DRUPAL_CLAMAV_ENABLED' => TRUE, | ||
'DRUPAL_CLAMAV_MODE' => 'daemon', | ||
'CLAMAV_HOST' => 'custom_clamav_host', | ||
'CLAMAV_PORT' => 3333, | ||
]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$config['clamav.settings']['scan_mode'] = 0; | ||
$config['clamav.settings']['mode_daemon_tcpip']['hostname'] = 'custom_clamav_host'; | ||
$config['clamav.settings']['mode_daemon_tcpip']['port'] = 3333; | ||
|
||
$this->assertConfigContains($config); | ||
} | ||
|
||
/** | ||
* Test ClamAV configs in Executable mode. | ||
*/ | ||
public function testClamavExecutable(): void { | ||
$this->setEnvVars([ | ||
'DRUPAL_CLAMAV_ENABLED' => TRUE, | ||
'CLAMAV_HOST' => 'custom_clamav_host', | ||
'CLAMAV_PORT' => 3333, | ||
]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$config['clamav.settings']['scan_mode'] = 1; | ||
$config['clamav.settings']['executable_path'] = '/usr/bin/clamscan'; | ||
|
||
$this->assertConfigContains($config); | ||
} | ||
|
||
/** | ||
* Test ClamAV configs in Daemon mode with defaults. | ||
*/ | ||
public function testClamavDaemonDefaults(): void { | ||
$this->setEnvVars([ | ||
'DRUPAL_CLAMAV_ENABLED' => TRUE, | ||
'DRUPAL_CLAMAV_MODE' => 'daemon', | ||
]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$config['clamav.settings']['scan_mode'] = 0; | ||
$config['clamav.settings']['mode_daemon_tcpip']['hostname'] = 'clamav'; | ||
$config['clamav.settings']['mode_daemon_tcpip']['port'] = 3310; | ||
|
||
$this->assertConfigContains($config); | ||
} | ||
|
||
/** | ||
* Test Config Split config. | ||
* | ||
* @dataProvider dataProviderConfigSplit | ||
*/ | ||
public function testConfigSplit(string $env, array $expected_present, array $expected_absent): void { | ||
$this->setEnvVars([ | ||
'DRUPAL_ENVIRONMENT' => $env, | ||
]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$this->assertConfigContains($expected_present); | ||
$this->assertConfigNotContains($expected_absent); | ||
} | ||
|
||
/** | ||
* Data provider for testConfigSplit(). | ||
*/ | ||
public function dataProviderConfigSplit(): array { | ||
return [ | ||
[ | ||
static::ENVIRONMENT_LOCAL, | ||
[ | ||
'config_split.config_split.local' => ['status' => TRUE], | ||
], | ||
[ | ||
'config_split.config_split.test' => NULL, | ||
'config_split.config_split.dev' => NULL, | ||
'config_split.config_split.ci' => NULL, | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_CI, | ||
[ | ||
'config_split.config_split.ci' => ['status' => TRUE], | ||
], | ||
[ | ||
'config_split.config_split.test' => NULL, | ||
'config_split.config_split.dev' => NULL, | ||
'config_split.config_split.local' => NULL, | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_DEV, | ||
[ | ||
'config_split.config_split.dev' => ['status' => TRUE], | ||
], | ||
[ | ||
'config_split.config_split.test' => NULL, | ||
'config_split.config_split.ci' => NULL, | ||
'config_split.config_split.local' => NULL, | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_TEST, | ||
[ | ||
'config_split.config_split.test' => ['status' => TRUE], | ||
], | ||
[ | ||
'config_split.config_split.dev' => NULL, | ||
'config_split.config_split.ci' => NULL, | ||
'config_split.config_split.local' => NULL, | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_PROD, | ||
[], | ||
[ | ||
'config_split.config_split.test' => NULL, | ||
'config_split.config_split.dev' => NULL, | ||
'config_split.config_split.ci' => NULL, | ||
'config_split.config_split.local' => NULL, | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_SUT, | ||
[], | ||
[ | ||
'config_split.config_split.test' => NULL, | ||
'config_split.config_split.dev' => NULL, | ||
'config_split.config_split.ci' => NULL, | ||
'config_split.config_split.local' => NULL, | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Test Environment Indicator config. | ||
* | ||
|
@@ -249,30 +105,6 @@ public function testRedis(): void { | |
$this->assertSettingsContains($settings); | ||
} | ||
|
||
/** | ||
* Test Redis partial settings. | ||
*/ | ||
public function testRedisPartial(): void { | ||
$this->setEnvVars([ | ||
'DRUPAL_REDIS_ENABLED' => 1, | ||
'REDIS_HOST' => 'redis_host', | ||
'REDIS_SERVICE_PORT' => 1234, | ||
'DREVOPS_REDIS_EXTENSION_LOADED' => 0, | ||
]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$settings['redis.connection']['interface'] = 'PhpRedis'; | ||
$settings['redis.connection']['host'] = 'redis_host'; | ||
$settings['redis.connection']['port'] = 1234; | ||
$no_settings['cache']['default'] = 'cache.backend.redis'; | ||
|
||
$this->assertArrayNotHasKey('bootstrap_container_definition', $this->settings); | ||
|
||
$this->assertSettingsContains($settings); | ||
$this->assertSettingsNotContains($no_settings); | ||
} | ||
|
||
/** | ||
* Test Shield config. | ||
* | ||
|
@@ -391,132 +223,4 @@ public function dataProviderShield(): array { | |
]; | ||
} | ||
|
||
/** | ||
* Test Stage File Proxy config. | ||
* | ||
* @dataProvider dataProviderStageFileProxy | ||
*/ | ||
public function testStageFileProxy(string $env, array $vars, array $expected_present, array $expected_absent = []): void { | ||
$this->setEnvVars($vars + ['DRUPAL_ENVIRONMENT' => $env]); | ||
|
||
$this->requireSettingsFile(); | ||
|
||
$this->assertConfigContains($expected_present); | ||
$this->assertConfigNotContains($expected_absent); | ||
} | ||
|
||
/** | ||
* Data provider for testStageFileProxy(). | ||
*/ | ||
public function dataProviderStageFileProxy(): array { | ||
return [ | ||
[ | ||
static::ENVIRONMENT_LOCAL, | ||
[], | ||
[], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://example.com/'], | ||
], | ||
], | ||
[ | ||
static::ENVIRONMENT_LOCAL, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://example.com/'], | ||
], | ||
[], | ||
], | ||
[ | ||
static::ENVIRONMENT_LOCAL, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
[], | ||
], | ||
[ | ||
static::ENVIRONMENT_LOCAL, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://example.com/'], | ||
], | ||
[], | ||
], | ||
|
||
[ | ||
static::ENVIRONMENT_CI, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
[], | ||
], | ||
|
||
[ | ||
static::ENVIRONMENT_DEV, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
[], | ||
], | ||
|
||
[ | ||
static::ENVIRONMENT_TEST, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
[], | ||
], | ||
|
||
[ | ||
static::ENVIRONMENT_PROD, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
], | ||
|
||
[ | ||
static::ENVIRONMENT_SUT, | ||
[ | ||
'DRUPAL_STAGE_FILE_PROXY_ORIGIN' => 'https://example.com/', | ||
'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
], | ||
[ | ||
'stage_file_proxy.settings' => ['hotlink' => FALSE, 'origin' => 'https://drupal_shield_user:[email protected]/'], | ||
], | ||
[], | ||
], | ||
]; | ||
} | ||
|
||
} |