function UsageTest::testTempFileCleanupDefault
Ensure that temporary files are removed by default.
File
- 
              core/
modules/ file/ tests/ src/ Kernel/ UsageTest.php, line 199  
Class
- UsageTest
 - Tests file usage functions.
 
Namespace
Drupal\Tests\file\KernelCode
public function testTempFileCleanupDefault() : void {
  [$temp_old, $temp_new, $perm_old, $perm_new] = $this->createTempFiles();
  // Run cron and then ensure that only the old, temp file was deleted.
  $this->container
    ->get('cron')
    ->run();
  $this->assertFileDoesNotExist($temp_old->getFileUri());
  $this->assertFileExists($temp_new->getFileUri());
  $this->assertFileExists($perm_old->getFileUri());
  $this->assertFileExists($perm_new->getFileUri());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.