function AttributeClassDiscoveryTest::testGetPluginNamespaces

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php \Drupal\Tests\Component\Plugin\Attribute\AttributeClassDiscoveryTest::testGetPluginNamespaces()

@covers ::__construct @covers ::getPluginNamespaces

File

core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php, line 39

Class

AttributeClassDiscoveryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Plugin%21Discovery%21AttributeClassDiscovery.php/class/AttributeClassDiscovery/11.x" title="Defines a discovery mechanism to find plugins with attributes." class="local">\Drupal\Component\Plugin\Discovery\AttributeClassDiscovery</a> @group Attribute @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Component\Plugin\Attribute

Code

public function testGetPluginNamespaces() : void {
    // Path to the classes which we'll discover and parse annotation.
    $discovery = new AttributeClassDiscovery([
        'com/example' => [
            __DIR__,
        ],
    ]);
    $reflection = new \ReflectionMethod($discovery, 'getPluginNamespaces');
    $reflection->setAccessible(TRUE);
    $result = $reflection->invoke($discovery);
    $this->assertEquals([
        'com/example' => [
            __DIR__,
        ],
    ], $result);
}

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