function UsageTest::testTempFileNoCleanup in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/UsageTest.php \Drupal\file\Tests\UsageTest::testTempFileNoCleanup()
Ensure that temporary files are kept as configured.
File
- core/
modules/ file/ src/ Tests/ UsageTest.php, line 176 - Contains \Drupal\file\Tests\UsageTest.
Class
- UsageTest
- Tests file usage functions.
Namespace
Drupal\file\TestsCode
function testTempFileNoCleanup() {
list($temp_old, $temp_new, $perm_old, $perm_new) = $this
->createTempFiles();
// Set the max age to 0, meaning no temporary files will be deleted.
$this
->config('system.file')
->set('temporary_maximum_age', 0)
->save();
// Run cron and then ensure that no file was 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.');
}