You are here

public function AnnotationBridgeDecoratorTest::testGetDefinitions in Drupal 8

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()

@covers ::getDefinitions

File

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

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());
}