function FileDeleteTest::testUnused
Tries deleting a normal file (as opposed to a directory, symlink, etc).
File
-
modules/
simpletest/ tests/ file.test, line 1752
Class
- FileDeleteTest
- Deletion related tests.
Code
function testUnused() {
$file = $this->createFile();
// Check that deletion removes the file and database record.
$this->assertTrue(is_file($file->uri), 'File exists.');
$this->assertIdentical(file_delete($file), TRUE, 'Delete worked.');
$this->assertFileHooksCalled(array(
'delete',
));
$this->assertFalse(file_exists($file->uri), 'Test file has actually been deleted.');
$this->assertFalse(file_load($file->fid), 'File was removed from the database.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.