function UsageTest::testTempFileCustomCleanup in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/UsageTest.php \Drupal\file\Tests\UsageTest::testTempFileCustomCleanup()
Ensure that temporary files are kept as configured.
File
- core/
modules/ file/ src/ Tests/ UsageTest.php, line 195 - Contains \Drupal\file\Tests\UsageTest.
Class
- UsageTest
- Tests file usage functions.
Namespace
Drupal\file\TestsCode
function testTempFileCustomCleanup() {
list($temp_old, $temp_new, $perm_old, $perm_new) = $this
->createTempFiles();
// Set the max age to older than default.
$this
->config('system.file')
->set('temporary_maximum_age', 21600 + 2)
->save();
// Run cron and then ensure that more files were deleted.
$this->container
->get('cron')
->run();
$this
->assertTrue(file_exists($temp_old
->getFileUri()), 'Old temp file was correctly ignored.');
$this
->assertTrue(file_exists($temp_new
->getFileUri()), 'New temp file was correctly ignored.');
$this
->assertTrue(file_exists($perm_old
->getFileUri()), 'Old permanent file was correctly ignored.');
$this
->assertTrue(file_exists($perm_new
->getFileUri()), 'New permanent file was correctly ignored.');
}