function FileDeleteTest::testUnused in Drupal 7
Tries deleting a normal file (as opposed to a directory, symlink, etc).
File
- modules/
simpletest/ tests/ file.test, line 1707 - This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.
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.');
}