FileUnmanagedDeleteRecursiveTest::testDirectory

  1. drupal
    1. 8
    2. 7
Versions
7 FileUnmanagedDeleteRecursiveTest::testDirectory()

Try deleting a directory with some files.

Code

modules/simpletest/tests/file.test, line 1285

<?php
function testDirectory() {
  // A directory to operate on.
  $directory = $this->createDirectory();
  $filepathA = $directory . '/A';
  $filepathB = $directory . '/B';
  file_put_contents($filepathA, '');
  file_put_contents($filepathB, '');

  // Delete the directory.
  $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.'));
  $this->assertFalse(file_exists($filepathA), t('Test file A has been deleted.'));
  $this->assertFalse(file_exists($filepathB), t('Test file B has been deleted.'));
  $this->assertFalse(file_exists($directory), t('Directory has been deleted.'));
}
?>