function AttributeClassDiscoveryTest::testGetDefinitions
Same name in other branches
- 11.x core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php \Drupal\Tests\Component\Plugin\Attribute\AttributeClassDiscoveryTest::testGetDefinitions()
@covers ::getDefinitions @covers ::prepareAttributeDefinition
File
-
core/
tests/ Drupal/ Tests/ Component/ Plugin/ Attribute/ AttributeClassDiscoveryTest.php, line 57
Class
- AttributeClassDiscoveryTest
- @coversDefaultClass \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery @group Attribute @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Component\Plugin\AttributeCode
public function testGetDefinitions() : void {
$discovery = new AttributeClassDiscovery([
'com\\example' => [
__DIR__ . "/../../../../../fixtures/plugins/Plugin",
],
]);
$this->assertEquals([
'discovery_test_1' => [
'id' => 'discovery_test_1',
'class' => 'com\\example\\PluginNamespace\\AttributeDiscoveryTest1',
],
], $discovery->getDefinitions());
$custom_annotation_discovery = new AttributeClassDiscovery([
'com\\example' => [
__DIR__ . "/../../../../../fixtures/plugins/Plugin",
],
], 'com\\example\\PluginNamespace\\CustomPlugin');
$this->assertEquals([
'discovery_test_1' => [
'id' => 'discovery_test_1',
'class' => 'com\\example\\PluginNamespace\\AttributeDiscoveryTest1',
'title' => 'Discovery test plugin',
],
], $custom_annotation_discovery->getDefinitions());
$empty_discovery = new AttributeClassDiscovery([
'com\\example' => [
__DIR__ . "/../../../../../fixtures/plugins/Plugin",
],
], 'com\\example\\PluginNamespace\\CustomPlugin2');
$this->assertEquals([], $empty_discovery->getDefinitions());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.