1.20.x file.test | FileUnmanagedDeleteRecursiveTest::testSingleFile() |
Delete a normal file.
File
- modules/
simpletest/ tests/ file.test, line 1473 - This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.
Class
- FileUnmanagedDeleteRecursiveTest
- Deletion related tests.
Code
function testSingleFile() {
// Create a file for testing
$filepath = file_default_scheme() . '://' . $this->randomName();
file_put_contents($filepath, '');
// Delete the file.
$this->assertTrue(file_unmanaged_delete_recursive($filepath), 'Function reported success.');
$this->assertFalse(file_exists($filepath), 'Test file has been deleted.');
}