You are here

public function EntityTest::testResolveTranslation in GraphQL 8.4

@covers \Drupal\graphql\Plugin\GraphQL\DataProducer\Entity\EntityTranslation::resolve @covers \Drupal\graphql\Plugin\GraphQL\DataProducer\Entity\EntityTranslations::resolve

File

tests/src/Kernel/DataProducer/EntityTest.php, line 255

Class

EntityTest
Data producers Entity test class.

Namespace

Drupal\Tests\graphql\Kernel\DataProducer

Code

public function testResolveTranslation() : void {
  $french = $this
    ->executeDataProducer('entity_translation', [
    'entity' => $this->node,
    'language' => 'fr',
  ]);
  $this
    ->assertEquals('sit amet fr', $french
    ->label());
  $translations = $this
    ->executeDataProducer('entity_translations', [
    'entity' => $this->node,
  ]);
  $this
    ->assertEquals('Dolor', $translations['en']
    ->label());
  $this
    ->assertEquals('sit amet fr', $translations['fr']
    ->label());
  $this
    ->assertEquals('sit amet de', $translations['de']
    ->label());
}