function ExtensionListTest::testReset

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testReset()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testReset()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testReset()

@covers ::reset

File

core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php, line 185

Class

ExtensionListTest
@coversDefaultClass \Drupal\Core\Extension\ExtensionList @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testReset() : void {
    $test_extension_list = $this->setupTestExtensionList();
    $path = $test_extension_list->getPath('test_name');
    $this->assertEquals('example/test_name', $path);
    $pathname = $test_extension_list->getPathname('test_name');
    $this->assertEquals('example/test_name/test_name.info.yml', $pathname);
    $filenames = $test_extension_list->getPathNames();
    $this->assertEquals([
        'test_name' => '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('example/test_name', $path);
    $pathname = $test_extension_list->getPathname('test_name');
    $this->assertEquals('example/test_name/test_name.info.yml', $pathname);
    $filenames = $test_extension_list->getPathNames();
    $this->assertEquals([
        'test_name' => 'example/test_name/test_name.info.yml',
    ], $filenames);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.