function UsageTest::testTempFileCleanupDefault

Same name in other branches
  1. 9 core/modules/file/tests/src/Kernel/UsageTest.php \Drupal\Tests\file\Kernel\UsageTest::testTempFileCleanupDefault()
  2. 10 core/modules/file/tests/src/Kernel/UsageTest.php \Drupal\Tests\file\Kernel\UsageTest::testTempFileCleanupDefault()
  3. 11.x core/modules/file/tests/src/Kernel/UsageTest.php \Drupal\Tests\file\Kernel\UsageTest::testTempFileCleanupDefault()

Ensure that temporary files are removed by default.

File

core/modules/file/tests/src/Kernel/UsageTest.php, line 193

Class

UsageTest
Tests file usage functions.

Namespace

Drupal\Tests\file\Kernel

Code

public function testTempFileCleanupDefault() {
    list($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->assertFileNotExists($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.