You are here

function FileDeleteTest::testNormal in SimpleTest 7

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

File

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

Class

FileDeleteTest
Deletion related tests.

Code

function testNormal() {
  $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(
    'references',
    '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.'));

  // TODO: implement hook_file_references() in file_test.module and report a
  // file in use and test the $force parameter.
}