You are here

public function FileDeleteRecursiveTest::testEmptyDirectory in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveTest::testEmptyDirectory()

Try deleting an empty directory.

File

core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php, line 28

Class

FileDeleteRecursiveTest
Tests the unmanaged file delete recursive function.

Namespace

Drupal\KernelTests\Core\File

Code

public function testEmptyDirectory() {

  // A directory to operate on.
  $directory = $this
    ->createDirectory();

  // Delete the directory.
  $this
    ->assertTrue(\Drupal::service('file_system')
    ->deleteRecursive($directory), 'Function reported success.');
  $this
    ->assertDirectoryDoesNotExist($directory);
}