function DeleteTest::testUnused

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

File

drupal/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php, line 25
Definition of Drupal\file\Tests\DeleteTest.

Class

DeleteTest
Deletion related tests.

Namespace

Drupal\file\Tests

Code

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

  // Check that deletion removes the file and database record.
  $this
    ->assertTrue(is_file($file->uri), t('File exists.'));
  $file
    ->delete();
  $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.'));
}