diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php index 17042c2..5944e5d 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php @@ -94,7 +94,22 @@ public function testDeleteAll() { // Make sure directory exists prior to removal. $this->assertTrue(file_exists(sys_get_temp_dir() . '/php/simpletest'), 'File storage directory does not exist.'); + // Write out some files. $php = $this->storageFactory->get('simpletest'); + $name = $this->randomName() . '/' . $this->randomName() . '.php'; + + // Find a global that doesn't exist. + do { + $random = mt_rand(10000, 100000); + } while (isset($GLOBALS[$random])); + + // Write out a PHP file and ensure it's successfully loaded. + $code = "save($name, $code); + $this->assertSame($success, TRUE); + $php->load($name); + $this->assertTrue($GLOBALS[$random]); + $this->assertTrue($php->deleteAll()); $this->assertFalse(file_exists(sys_get_temp_dir() . '/php/simpletest'), 'File storage directory still exists after call to deleteAll().');