FileUnmanagedDeleteRecursiveTest::testSingleFile

  1. drupal
    1. 8
    2. 7
Versions
7 FileUnmanagedDeleteRecursiveTest::testSingleFile()

Delete a normal file.

Code

modules/simpletest/tests/file.test, line 1260

<?php
function testSingleFile() {
  // Create a file for testing
  $filepath = file_default_scheme() . '://' . $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.'));
}
?>