3 namespace Drupal\Tests\ctools\Kernel;
5 use Drupal\Core\Language\LanguageInterface;
8 * @coversDefaultClass \Drupal\ctools\Plugin\Relationship\TypedDataEntityRelationship
11 class TypedDataLanguageRelationshipPluginTest extends RelationshipsTestBase {
16 public function testRelationshipName() {
17 /** @var \Drupal\ctools\Plugin\RelationshipInterface $langcode_plugin */
18 $langcode_plugin = $this->relationshipManager->createInstance('typed_data_language_relationship:entity:node:langcode');
19 $this->assertSame('langcode', $langcode_plugin->getName());
23 * @covers ::getRelationship
25 * @todo expand to include a new language.
27 public function testRelationship() {
28 /** @var \Drupal\ctools\Plugin\RelationshipInterface $langcode_plugin */
29 $langcode_plugin = $this->relationshipManager->createInstance('typed_data_language_relationship:entity:node:langcode');
30 $langcode_plugin->setContextValue('base', $this->entities['node1']);
31 $relationship = $langcode_plugin->getRelationship();
32 $this->assertTrue($relationship->getContextValue() instanceof LanguageInterface);
33 $this->assertSame('en', $relationship->getContextValue()->getId());