function AnnotatedClassDiscoveryTest::testGetDefinitions
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php \Drupal\Tests\Component\Annotation\AnnotatedClassDiscoveryTest::testGetDefinitions()
- 10 core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php \Drupal\Tests\Component\Annotation\AnnotatedClassDiscoveryTest::testGetDefinitions()
- 11.x core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php \Drupal\Tests\Component\Annotation\AnnotatedClassDiscoveryTest::testGetDefinitions()
@covers ::getDefinitions @covers ::prepareAnnotationDefinition @covers ::getAnnotationReader
File
-
core/
tests/ Drupal/ Tests/ Component/ Annotation/ AnnotatedClassDiscoveryTest.php, line 47
Class
- AnnotatedClassDiscoveryTest
- @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery @group Annotation @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Component\AnnotationCode
public function testGetDefinitions() {
$discovery = new AnnotatedClassDiscovery([
'com\\example' => [
__DIR__ . '/Fixtures',
],
]);
$this->assertEquals([
'discovery_test_1' => [
'id' => 'discovery_test_1',
'class' => 'com\\example\\PluginNamespace\\DiscoveryTest1',
],
], $discovery->getDefinitions());
$custom_annotation_discovery = new AnnotatedClassDiscovery([
'com\\example' => [
__DIR__ . '/Fixtures',
],
], CustomPlugin::class, [
'Drupal\\Tests\\Component\\Annotation',
]);
$this->assertEquals([
'discovery_test_1' => [
'id' => 'discovery_test_1',
'class' => 'com\\example\\PluginNamespace\\DiscoveryTest1',
'title' => 'Discovery test plugin',
],
], $custom_annotation_discovery->getDefinitions());
$empty_discovery = new AnnotatedClassDiscovery([
'com\\example' => [
__DIR__ . '/Fixtures',
],
], CustomPlugin2::class, [
'Drupal\\Tests\\Component\\Annotation',
]);
$this->assertEquals([], $empty_discovery->getDefinitions());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.