class CustomAnnotationClassDiscoveryTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php \Drupal\KernelTests\Core\Plugin\Discovery\CustomAnnotationClassDiscoveryTest
Tests that a custom annotation class is used.
@group Plugin
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\Core\Plugin\Discovery\CustomAnnotationClassDiscoveryTest implements \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase
- class \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of CustomAnnotationClassDiscoveryTest
See also
\Drupal\plugin_test\Plugin\Annotation\PluginExample
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Discovery/ CustomAnnotationClassDiscoveryTest.php, line 13
Namespace
Drupal\KernelTests\Core\Plugin\DiscoveryView source
class CustomAnnotationClassDiscoveryTest extends DiscoveryTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->expectedDefinitions = [
'example_1' => [
'id' => 'example_1',
'custom' => 'John',
'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\custom_annotation\\Example1',
'provider' => 'plugin_test',
],
'example_2' => [
'id' => 'example_2',
'custom' => 'Paul',
'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\custom_annotation\\Example2',
'provider' => 'plugin_test',
],
];
$base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src';
$root_namespaces = new \ArrayObject([
'Drupal\\plugin_test' => $base_directory,
]);
$this->discovery = new AnnotatedClassDiscovery('Plugin/plugin_test/custom_annotation', $root_namespaces, 'Drupal\\plugin_test\\Plugin\\Annotation\\PluginExample');
$this->emptyDiscovery = new AnnotatedClassDiscovery('Plugin/non_existing_module/non_existing_plugin_type', $root_namespaces, 'Drupal\\plugin_test\\Plugin\\Annotation\\PluginExample');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.