public function AnnotatedClassDiscoveryTest::setUp

Sets up unit test environment.

Unlike Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does not install modules because tests are performed without accessing the database. Any required files must be explicitly included by the child class setUp() method.

Overrides UnitTestBase::setUp

File

drupal/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php, line 25
Definition of Drupal\system\Tests\Plugin\Discovery\AnnotatedClassDiscoveryTest.

Class

AnnotatedClassDiscoveryTest
Tests that plugins with annotated classes are correctly discovered.

Namespace

Drupal\system\Tests\Plugin\Discovery

Code

public function setUp() {
  parent::setUp();
  $this->expectedDefinitions = array(
    'apple' => array(
      'id' => 'apple',
      'label' => 'Apple',
      'color' => 'green',
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\Apple',
    ),
    'banana' => array(
      'id' => 'banana',
      'label' => 'Banana',
      'color' => 'yellow',
      'uses' => array(
        'bread' => t('Banana bread'),
      ),
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\Banana',
    ),
    'cherry' => array(
      'id' => 'cherry',
      'label' => 'Cherry',
      'color' => 'red',
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\Cherry',
    ),
    'orange' => array(
      'id' => 'orange',
      'label' => 'Orange',
      'color' => 'orange',
      'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\Orange',
    ),
  );
  $this->discovery = new AnnotatedClassDiscovery('plugin_test', 'fruit');
  $this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module', 'non_existing_plugin_type');
}