Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Plugin / Discovery / CustomAnnotationClassDiscoveryTest.php
1 <?php
2
3 namespace Drupal\KernelTests\Core\Plugin\Discovery;
4
5 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
6
7 /**
8  * Tests that a custom annotation class is used.
9  *
10  * @group Plugin
11  * @see \Drupal\plugin_test\Plugin\Annotation\PluginExample
12  */
13 class CustomAnnotationClassDiscoveryTest extends DiscoveryTestBase {
14
15   protected function setUp() {
16     parent::setUp();
17
18     $this->expectedDefinitions = [
19       'example_1' => [
20         'id' => 'example_1',
21         'custom' => 'John',
22         'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example1',
23         'provider' => 'plugin_test',
24       ],
25       'example_2' => [
26         'id' => 'example_2',
27         'custom' => 'Paul',
28         'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example2',
29         'provider' => 'plugin_test',
30       ],
31     ];
32
33     $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src';
34     $root_namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory]);
35
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');
38   }
39
40 }