diff --git a/core/modules/system/src/Tests/System/HtaccessTest.php b/core/modules/system/src/Tests/System/HtaccessTest.php index c0a72c9..028956f 100644 --- a/core/modules/system/src/Tests/System/HtaccessTest.php +++ b/core/modules/system/src/Tests/System/HtaccessTest.php @@ -7,7 +7,6 @@ namespace Drupal\system\Tests\System; -use Drupal\Core\Site\Settings; use Drupal\simpletest\WebTestBase; /** @@ -18,12 +17,37 @@ class HtaccessTest extends WebTestBase { /** - * Tests accessing disallowed file extensions. + * Modules to enable. + * + * @var array */ - function testDisallowedExtensions() { - // Try accessing a yml file. + public static $modules = ['file']; + + /** + * Tests accessing YAML file extensions. + */ + public function testYamlFileAccess() { + // Try accessing the core services YAML file. $this->drupalGet('core/core.services.yml'); $this->assertResponse(403); + // Try accessing a core module YAML file. + $this->drupalGet('core/modules/system/system.services.yml'); + $this->assertResponse(403); + + $file_params = array( + 'filename' => 'test.yml', + 'uri' => 'public://test.yml', + 'filemime' => 'text/yaml', + 'status' => FILE_STATUS_PERMANENT, + ); + // Create a new file entity. + $file = entity_create('file', $file_params); + file_put_contents($file->getFileUri(), 'test: value'); + $file->save(); + + // Access the file saved in the public files directory. + $this->drupalGet($file->url()); + $this->assertResponse(200); } }