You are here

function FileUnmanagedDeleteRecursiveTest::testSingleFile in SimpleTest 7

Delete a normal file.

File

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

Class

FileUnmanagedDeleteRecursiveTest
Deletion related tests.

Code

function testSingleFile() {

  // Create a file for testing
  $filepath = file_directory_path() . '/' . $this
    ->randomName();
  file_put_contents($filepath, '');

  // Delete the file.
  $this
    ->assertTrue(file_unmanaged_delete_recursive($filepath), t('Function reported success.'));
  $this
    ->assertFalse(file_exists($filepath), t('Test file has been deleted.'));
}