// 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);
// Verify that site directory and the settings.php remain writable when
// automatically enforcing file permissions is disabled.
$this->
assertDirectoryIsWritable($site_path);
$this->
assertFileIsWritable($settings_file);
// Re-enable permissions enforcement.
$settings = Settings::
getAll();
$settings['skip_permissions_hardening'
] = FALSE;
new Settings($settings);
// Manually trigger the requirements check.
$requirements =
$this->
checkSystemRequirements();
$this->
assertEquals('Protected',
(string) $requirements['configuration_files'
]['value'
]);