// Test directory permission modification.
$this->
setSetting('file_chmod_directory', 0777
);
$this->
assertTrue($file_system->
prepareDirectory($directory, FileSystemInterface::MODIFY_PERMISSIONS
), 'No error reported when making directory writable.'
);
} // Test that the directory has the correct permissions.
$this->
assertDirectoryPermissions($directory, 0777, 'file_chmod_directory setting is respected.'
);
// Remove .htaccess file to then test that it gets re-created.
@
$file_system->
unlink($default_scheme . '://.htaccess'
);
$this->
assertFileDoesNotExist($default_scheme . '://.htaccess'
);
$this->container->
get('file.htaccess_writer'
)->
ensure();
$this->
assertFileExists($default_scheme . '://.htaccess'
);
// Remove .htaccess file again to test that it is re-created by a cron run.
@
$file_system->
unlink($default_scheme . '://.htaccess'
);
$this->
assertFileDoesNotExist($default_scheme . '://.htaccess'
);
system_cron();
$this->
assertFileExists($default_scheme . '://.htaccess'
);
// Verify contents of .htaccess file.
$file =
file_get_contents($default_scheme . '://.htaccess'
);
$this->
assertEquals(FileSecurity::
htaccessLines(FALSE
),
$file, 'The .htaccess file contains the proper content.'
);
}