1 file.test | FileUnmanagedDeleteRecursiveTest::testSingleFile() |
Delete a normal file.
File
- core/
modules/ simpletest/ tests/ file.test, line 1466 - 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.');
}