diff --git a/core/modules/system/src/Tests/System/HtaccessTest.php b/core/modules/system/src/Tests/System/HtaccessTest.php index 3335033..29f133d 100644 --- a/core/modules/system/src/Tests/System/HtaccessTest.php +++ b/core/modules/system/src/Tests/System/HtaccessTest.php @@ -21,10 +21,20 @@ class HtaccessTest extends WebTestBase { */ public function testYamlFileAccess() { // Try accessing the core services YAML file. - $this->drupalGet('core/core.services.yml'); - $this->assertResponse(403); + $this->assertNoFileAccess('core/core.services.yml'); // Try accessing a core module YAML file. - $this->drupalGet('core/modules/system/system.services.yml'); + $this->assertNoFileAccess('core/modules/system/system.services.yml'); + } + + /** + * Asserts that a file exists but not accessible via HTTP. + * + * @param $path + * Path to file. Without leading slash. + */ + protected function assertNoFileAccess($path) { + $this->assertTrue(file_exists(DRUPAL_ROOT . '/' . $path)); + $this->drupalGet($path); $this->assertResponse(403); }