function FileDeleteTest::testDirectory
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testDirectory()
- 8.9.x core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testDirectory()
- 11.x core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testDirectory()
Try deleting a directory.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ File/ FileDeleteTest.php, line 39
Class
- FileDeleteTest
- Tests the unmanaged file delete function.
Namespace
Drupal\KernelTests\Core\FileCode
public function testDirectory() : void {
// A directory to operate on.
$directory = $this->createDirectory();
// Try to delete a directory.
try {
\Drupal::service('file_system')->delete($directory);
$this->fail('Expected NotRegularFileException');
} catch (NotRegularFileException $e) {
// Ignore.
}
$this->assertDirectoryExists($directory);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.