diff --git a/.circleci/config.yml b/.circleci/config.yml index d117cddd6..8f29bcf09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ job-build-no-persist: &job-build-no-persist command: docker compose exec -T cli vendor/bin/twigcs || [ "${DREVOPS_CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ] - run: name: Lint code with NPM linters - command: docker compose exec -T cli bash -c "npm run --prefix \${DREVOPS_WEBROOT}/themes/custom/\${DRUPAL_THEME} lint" || [ "${DREVOPS_CI_NPM_LINT_IGNORE_FAILURE:-0}" -eq 1 ] + command: docker compose exec -T cli bash -c "npm run --prefix \${DREVOPS_WEBROOT}/themes/contrib/\${DRUPAL_THEME} lint" || [ "${DREVOPS_CI_NPM_LINT_IGNORE_FAILURE:-0}" -eq 1 ] - run: name: Run tooling tests command: ./scripts/test-tooling.sh diff --git a/tests/phpunit/Drupal/SwitchableSettingsTest.php b/tests/phpunit/Drupal/SwitchableSettingsTest.php index ef5284a3a..36365d9d0 100644 --- a/tests/phpunit/Drupal/SwitchableSettingsTest.php +++ b/tests/phpunit/Drupal/SwitchableSettingsTest.php @@ -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:drupal_shield_pass@example.com/'], - ], - [], - ], - [ - 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:drupal_shield_pass@example.com/'], - ], - [], - ], - - [ - 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:drupal_shield_pass@example.com/'], - ], - [], - ], - - [ - 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:drupal_shield_pass@example.com/'], - ], - [], - ], - - [ - 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:drupal_shield_pass@example.com/'], - ], - ], - - [ - 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:drupal_shield_pass@example.com/'], - ], - [], - ], - ]; - } - }