FileSaveHtaccessLoggingTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/File/FileSaveHtaccessLoggingTest.php
View source
<?php
namespace Drupal\system\Tests\File;
use Drupal\Component\PhpStorage\FileStorage;
use Drupal\simpletest\WebTestBase;
class FileSaveHtaccessLoggingTest extends WebTestBase {
protected static $modules = [
'dblog',
];
function testHtaccessSave() {
$private = $this->publicFilesDirectory . '/test/private';
$this
->assertFalse(file_save_htaccess($private, TRUE));
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('admin/reports/dblog');
$this
->clickLink("Security warning: Couldn't write .htaccess file. Please…");
$lines = FileStorage::htaccessLines(TRUE);
foreach (array_filter(explode("\n", $lines)) as $line) {
$this
->assertEscaped($line);
}
}
}