You are here

protected function CustomAnnotationClassDiscoveryTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php \Drupal\system\Tests\Plugin\Discovery\CustomAnnotationClassDiscoveryTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/system/src/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php, line 20
Contains \Drupal\system\Tests\Plugin\Discovery\CustomAnnotationClassDiscoveryTest.

Class

CustomAnnotationClassDiscoveryTest
Tests that a custom annotation class is used.

Namespace

Drupal\system\Tests\Plugin\Discovery

Code

protected function setUp() {
  parent::setUp();
  $this->expectedDefinitions = array(
    'example_1' => array(
      'id' => 'example_1',
      'custom' => 'John',
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\custom_annotation\\Example1',
      'provider' => 'plugin_test',
    ),
    'example_2' => array(
      'id' => 'example_2',
      'custom' => 'Paul',
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\custom_annotation\\Example2',
      'provider' => 'plugin_test',
    ),
  );
  $base_directory = \Drupal::root() . '/core/modules/system/tests/modules/plugin_test/src';
  $root_namespaces = new \ArrayObject(array(
    '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');
}