public function FileDeleteRecursiveTest::testSingleFile in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveTest::testSingleFile()
- 9 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
->assertFileDoesNotExist($filepath);
}