You are here

protected function YamlDiscoveryDecoratorTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryDecoratorTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php, line 41
Contains \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryDecoratorTest.

Class

YamlDiscoveryDecoratorTest
YamlDiscoveryDecorator unit tests.

Namespace

Drupal\Tests\Core\Plugin\Discovery

Code

protected function setUp() {
  parent::setUp();
  $base_path = __DIR__ . '/Fixtures';

  // Set up the directories to search.
  $directories = array(
    'test_1' => $base_path . '/test_1',
    'test_2' => $base_path . '/test_2',
  );
  $definitions = array(
    'decorated_test_1' => array(
      'id' => 'decorated_test_1',
      'name' => 'Decorated test 1',
      'provider' => 'decorated_1',
    ),
    'decorated_test_2' => array(
      'id' => 'decorated_test_2',
      'name' => 'Decorated test 1',
      'provider' => 'decorated_2',
    ),
  );
  $decorated = $this
    ->getMock('Drupal\\Component\\Plugin\\Discovery\\DiscoveryInterface');
  $decorated
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->will($this
    ->returnValue($definitions));
  $this->discoveryDecorator = new YamlDiscoveryDecorator($decorated, 'test', $directories);
}