diff --git a/core/lib/Drupal/Core/Extension/ExtensionList.php b/core/lib/Drupal/Core/Extension/ExtensionList.php index 7a54d3cb26..a929226370 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ExtensionList.php @@ -174,7 +174,8 @@ public function reset() { // We explicitly don't reset the addedFileNames as it is sort of a static // cache. // @todo In the long run it would be great to add the reset, but the early - // installer fails due to that. + // installer fails due to that. https://www.drupal.org/node/2719315 could + // help to resolve with that. return $this; } diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php index 3e4da510f6..da4b322a14 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php @@ -174,6 +174,34 @@ public function testGetPath() { } /** + * @covers ::reset + */ + public function testReset() { + $test_extension_list = $this->setupTestExtensionList(); + + $path = $test_extension_list->getPath('test_name'); + $this->assertEquals('vfs://drupal_root/example/test_name', $path); + $pathname = $test_extension_list->getPathname('test_name'); + $this->assertEquals('vfs://drupal_root/example/test_name/test_name.info.yml', $pathname); + $filenames = $test_extension_list->getPathnames(); + $this->assertEquals([ + 'test_name' => 'vfs://drupal_root/example/test_name/test_name.info.yml', + ], $filenames); + + $test_extension_list->reset(); + + // Ensure that everything is still usable after the resetting. + $path = $test_extension_list->getPath('test_name'); + $this->assertEquals('vfs://drupal_root/example/test_name', $path); + $pathname = $test_extension_list->getPathname('test_name'); + $this->assertEquals('vfs://drupal_root/example/test_name/test_name.info.yml', $pathname); + $filenames = $test_extension_list->getPathnames(); + $this->assertEquals([ + 'test_name' => 'vfs://drupal_root/example/test_name/test_name.info.yml', + ], $filenames); + } + + /** * @return \Drupal\Tests\Core\Extension\TestExtension */ protected function setupTestExtensionList($extension_names = ['test_name']) {