3 namespace Drupal\KernelTests\Core\Plugin\Discovery;
5 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
8 * Tests that a custom annotation class is used.
11 * @see \Drupal\plugin_test\Plugin\Annotation\PluginExample
13 class CustomAnnotationClassDiscoveryTest extends DiscoveryTestBase {
15 protected function setUp() {
18 $this->expectedDefinitions = [
22 'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example1',
23 'provider' => 'plugin_test',
28 'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example2',
29 'provider' => 'plugin_test',
33 $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src';
34 $root_namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory]);
36 $this->discovery = new AnnotatedClassDiscovery('Plugin/plugin_test/custom_annotation', $root_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
37 $this->emptyDiscovery = new AnnotatedClassDiscovery('Plugin/non_existing_module/non_existing_plugin_type', $root_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');