/**
* Tests writable files remain writable when directory hardening is disabled.
*/
public function testSitesDirectoryHardeningConfig() { $site_path =
$this->kernel->
getSitePath();
$settings_file =
$this->
settingsFile($site_path);
// Disable permissions enforcement.
$settings = Settings::
getAll();
$settings['skip_permissions_hardening'
] = TRUE;
new Settings($settings);
$this->
assertTrue(Settings::
get('skip_permissions_hardening'
), 'Able to set skip permissions hardening to true.'
);
$this->
makeWritable($site_path);
// Manually trigger the requirements check.
$requirements =
$this->
checkSystemRequirements();
$this->
assertEquals(REQUIREMENT_WARNING,
$requirements['configuration_files'
]['severity'
], 'Warning severity is properly set.'
);
$this->
assertEquals('Protection disabled',
(string) $requirements['configuration_files'
]['value'
]);
$description =
strip_tags(\Drupal::
service('renderer'
)->
renderPlain($requirements['configuration_files'
]['description'
]));
$this->
assertStringContainsString('settings.php is not protected from modifications and poses a security risk.',
$description);
$this->
assertStringContainsString('services.yml is not protected from modifications and poses a security risk.',
$description);