function FileUnmanagedDeleteRecursiveTest::testSingleFile

Delete a normal file.

File

modules/simpletest/tests/file.test, line 1477

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.