1 file.test | FileDeleteTest::testUnused() |
Tries deleting a normal file (as opposed to a directory, symlink, etc).
File
- core/
modules/ simpletest/ tests/ file.test, line 1714 - 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.');
$file->delete();
$this->assertFileHooksCalled(array('delete', 'load'));
$this->assertFalse(file_exists($file->uri), 'Test file has actually been deleted.');
$this->assertFalse(file_load($file->fid), 'File was removed from the database.');
}