function FileSecurityTest::testWriteHtaccessForceOverwrite
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php \Drupal\Tests\Component\FileSecurity\FileSecurityTest::testWriteHtaccessForceOverwrite()
- 10 core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php \Drupal\Tests\Component\FileSecurity\FileSecurityTest::testWriteHtaccessForceOverwrite()
- 11.x core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php \Drupal\Tests\Component\FileSecurity\FileSecurityTest::testWriteHtaccessForceOverwrite()
@covers ::writeHtaccess
File
-
core/
tests/ Drupal/ Tests/ Component/ FileSecurity/ FileSecurityTest.php, line 46
Class
- FileSecurityTest
- Tests the file security component.
Namespace
Drupal\Tests\Component\FileSecurityCode
public function testWriteHtaccessForceOverwrite() {
vfsStream::setup('root');
$htaccess_file = vfsStream::url('root') . '/.htaccess';
file_put_contents($htaccess_file, "foo");
$this->assertTrue(FileSecurity::writeHtaccess(vfsStream::url('root'), TRUE, TRUE));
$htaccess_contents = file_get_contents($htaccess_file);
$this->assertContains("Require all denied", $htaccess_contents);
$this->assertNotContains("foo", $htaccess_contents);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.