TypedDataLanguageRelationshipPluginTest.php in Chaos Tool Suite (ctools) 8.3
File
tests/src/Kernel/TypedDataLanguageRelationshipPluginTest.php
View source
<?php
namespace Drupal\Tests\ctools\Kernel;
use Drupal\Core\Language\LanguageInterface;
class TypedDataLanguageRelationshipPluginTest extends RelationshipsTestBase {
public function testRelationshipName() {
$langcode_plugin = $this->relationshipManager
->createInstance('typed_data_language_relationship:entity:node:langcode');
$this
->assertSame('langcode', $langcode_plugin
->getName());
}
public function testRelationship() {
$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());
}
}