function AnnotationBridgeDecoratorTest::testGetDefinitions

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php \Drupal\Tests\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecoratorTest::testGetDefinitions()
  2. 10 core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php \Drupal\Tests\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecoratorTest::testGetDefinitions()
  3. 11.x core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php \Drupal\Tests\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecoratorTest::testGetDefinitions()

@covers ::getDefinitions

File

core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php, line 23

Class

AnnotationBridgeDecoratorTest
@coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator @group Plugin

Namespace

Drupal\Tests\Component\Annotation\Plugin\Discovery

Code

public function testGetDefinitions() {
    $definitions = [];
    $definitions['object'] = new ObjectDefinition([
        'id' => 'foo',
    ]);
    $definitions['array'] = [
        'id' => 'bar',
    ];
    $discovery = $this->prophesize(DiscoveryInterface::class);
    $discovery->getDefinitions()
        ->willReturn($definitions);
    $decorator = new AnnotationBridgeDecorator($discovery->reveal(), TestAnnotation::class);
    $expected = [
        'object' => new ObjectDefinition([
            'id' => 'foo',
        ]),
        'array' => new ObjectDefinition([
            'id' => 'bar',
        ]),
    ];
    $this->assertEquals($expected, $decorator->getDefinitions());
}

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