function AnnotationBridgeDecoratorTest::testGetDefinitions

Same name and namespace in other branches
  1. 9 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 20

Class

AnnotationBridgeDecoratorTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Annotation%21Plugin%21Discovery%21AnnotationBridgeDecorator.php/class/AnnotationBridgeDecorator/8.9.x" title="Ensures that all definitions are run through the annotation process." class="local">\Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator</a> @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.