function TypedDataLanguageRelationshipPluginTest::testRelationship

Same name in other branches
  1. 4.0.x tests/src/Kernel/TypedDataLanguageRelationshipPluginTest.php \Drupal\Tests\ctools\Kernel\TypedDataLanguageRelationshipPluginTest::testRelationship()

@covers ::getRelationship

@todo expand to include a new language.

File

tests/src/Kernel/TypedDataLanguageRelationshipPluginTest.php, line 27

Class

TypedDataLanguageRelationshipPluginTest
@coversDefaultClass \Drupal\ctools\Plugin\Relationship\TypedDataEntityRelationship @group CTools

Namespace

Drupal\Tests\ctools\Kernel

Code

public function testRelationship() {
    
    /** @var \Drupal\ctools\Plugin\RelationshipInterface $langcode_plugin */
    $langcode_plugin = $this->relationshipManager
        ->createInstance('typed_data_language_relationship:entity:node:langcode');
    $langcode_plugin->setContextValue('base', $this->entities['node1']);
    $relationship = $langcode_plugin->getRelationship();
    $this->assertTrue($relationship->getContextValue() instanceof LanguageInterface);
    $this->assertSame('en', $relationship->getContextValue()
        ->getId());
}