function RelationshipManagerTest::testRelationshipConstraints

Same name and namespace in other branches
  1. 8.x-3.x tests/src/Kernel/RelationshipManagerTest.php \Drupal\Tests\ctools\Kernel\RelationshipManagerTest::testRelationshipConstraints()

@covers ::getDefinitions

File

tests/src/Kernel/RelationshipManagerTest.php, line 17

Class

RelationshipManagerTest
@coversDefaultClass \Drupal\ctools\Plugin\RelationshipManager[[api-linebreak]] @group CTools

Namespace

Drupal\Tests\ctools\Kernel

Code

public function testRelationshipConstraints() {
  $definitions = $this->relationshipManager
    ->getDefinitions();
  $expected = [
    'Bundle' => [
      0 => "page",
      1 => "foo",
    ],
  ];
  $this->assertSame($expected, $definitions['typed_data_relationship:entity:node:body']['context_definitions']['base']->getConstraints());
  // Check that typed data primitive labels are formatted properly.
  $this->assertSame('Body from Page and Foo', (string) $definitions['typed_data_relationship:entity:node:body']['label']);
  // Check that entity relationship labels are formatted properly.
  $this->assertSame('Authored by Entity from Content', (string) $definitions['typed_data_entity_relationship:entity:node:uid']['label']);
  // Check that language relationship labels are formatted properly.
  $this->assertSame('Language Language from Content', (string) $definitions['typed_data_language_relationship:entity:node:langcode']['label']);
}