public function FileDeleteTest::testDirectory in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testDirectory()
- 10 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 37
Class
- FileDeleteTest
- Tests the unmanaged file delete function.
Namespace
Drupal\KernelTests\Core\FileCode
public function testDirectory() {
// 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);
}