FileDeleteTest::testUnused

7 file.test FileDeleteTest::testUnused()
8 file.test FileDeleteTest::testUnused()

Tries deleting a normal file (as opposed to a directory, symlink, etc).

File

modules/simpletest/tests/file.test, line 1546
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Code

function testUnused() {
  $file = $this->createFile();

  // Check that deletion removes the file and database record.
  $this->assertTrue(is_file($file->uri), t('File exists.'));
  $this->assertIdentical(file_delete($file), TRUE, t('Delete worked.'));
  $this->assertFileHooksCalled(array('delete'));
  $this->assertFalse(file_exists($file->uri), t('Test file has actually been deleted.'));
  $this->assertFalse(file_load($file->fid), t('File was removed from the database.'));
}
Login or register to post comments