class FileDeleteRecursiveTest extends FileTestBase
{ /**
* Delete a normal file.
*/
public function testSingleFile() { // Create a file for testing
$filepath = 'public://' .
$this->
randomMachineName();
file_put_contents($filepath, ''
);
// Delete the file.
$this->
assertTrue(\Drupal::
service('file_system'
)->
deleteRecursive($filepath), 'Function reported success.'
);
$this->
assertFileDoesNotExist($filepath);
} /**
* Try deleting an empty directory.
*/
public function testEmptyDirectory() { // A directory to operate on.
$directory =
$this->
createDirectory();
// Delete the directory.