function FileDeleteRecursiveTest::testSingleFile
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveTest::testSingleFile()
- 10 core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveTest::testSingleFile()
- 11.x core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveTest::testSingleFile()
Delete a normal file.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ File/ FileDeleteRecursiveTest.php, line 15
Class
- FileDeleteRecursiveTest
- Tests the unmanaged file delete recursive function.
Namespace
Drupal\KernelTests\Core\FileCode
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->assertFileNotExists($filepath);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.