public function UsageTest::testTempFileCleanupDefault in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/tests/src/Kernel/UsageTest.php \Drupal\Tests\file\Kernel\UsageTest::testTempFileCleanupDefault()
- 9 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 197
Class
- UsageTest
- Tests file usage functions.
Namespace
Drupal\Tests\file\KernelCode
public function testTempFileCleanupDefault() {
[
$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());
}