Chris@18: container->get('file_system'); Chris@18: Chris@18: $file_name = $file_system->saveData($this->randomMachineName(), 'public://'); Chris@18: $this->assertNotNull($file_name); Chris@18: Chris@18: // During testing the file change and the stale checking occurs in the same Chris@18: // request, so the beginning of request will be before the file changes and Chris@18: // REQUEST_TIME - $filectime is negative or zero. Set the maximum age to a Chris@18: // number even smaller than that. Chris@18: $this->config('system.file') Chris@18: ->set('temporary_maximum_age', -100000) Chris@18: ->save(); Chris@18: Chris@18: $file_path = $file_system->realpath($file_name); Chris@18: update_delete_file_if_stale($file_path); Chris@18: Chris@18: $this->assertFileNotExists($file_path); Chris@18: } Chris@18: Chris@18: }