function YamlDiscoveryDecoratorTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryDecoratorTest::setUp()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryDecoratorTest::setUp()
  3. 11.x 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 36

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 = [
        'test_1' => $base_path . '/test_1',
        'test_2' => $base_path . '/test_2',
    ];
    $definitions = [
        'decorated_test_1' => [
            'id' => 'decorated_test_1',
            'name' => 'Decorated test 1',
            'provider' => 'decorated_1',
        ],
        'decorated_test_2' => [
            'id' => 'decorated_test_2',
            'name' => 'Decorated test 1',
            'provider' => 'decorated_2',
        ],
    ];
    $decorated = $this->createMock('Drupal\\Component\\Plugin\\Discovery\\DiscoveryInterface');
    $decorated->expects($this->once())
        ->method('getDefinitions')
        ->will($this->returnValue($definitions));
    $this->discoveryDecorator = new YamlDiscoveryDecorator($decorated, 'test', $directories);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.