public function UsageTest::testTempFileNoCleanup in Drupal 8
Same name and namespace in other branches
- 9 core/modules/file/tests/src/Kernel/UsageTest.php \Drupal\Tests\file\Kernel\UsageTest::testTempFileNoCleanup()
Ensure that temporary files are kept as configured.
File
- core/
modules/ file/ tests/ src/ Kernel/ UsageTest.php, line 207
Class
- UsageTest
- Tests file usage functions.
Namespace
Drupal\Tests\file\KernelCode
public 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
->assertFileExists($temp_old
->getFileUri());
$this
->assertFileExists($temp_new
->getFileUri());
$this
->assertFileExists($perm_old
->getFileUri());
$this
->assertFileExists($perm_new
->getFileUri());
}