You are here

public function LanguageTest::testLanguageId in GraphQL 8.3

Test listing of available languages.

File

modules/graphql_core/tests/src/Kernel/Languages/LanguageTest.php, line 52

Class

LanguageTest
Test multilingual behavior.

Namespace

Drupal\Tests\graphql_core\Kernel\Languages

Code

public function testLanguageId() {
  $metadata = $this
    ->defaultCacheMetaData();

  // TODO: Should this also contain the language config cache metadata?
  $this
    ->assertResults($this
    ->getQueryFromFile('languages.gql'), [], [
    'languages' => [
      0 => [
        'id' => 'en',
        'name' => 'English',
        'isDefault' => TRUE,
        'isLocked' => FALSE,
        'direction' => 'ltr',
        'weight' => 0,
        'argument' => 'en',
      ],
      1 => [
        'id' => 'fr',
        'name' => 'French',
        'isDefault' => FALSE,
        'isLocked' => FALSE,
        'direction' => 'ltr',
        'weight' => 1,
        'argument' => 'fr',
      ],
      2 => [
        'id' => 'es',
        'name' => 'Spanish',
        'isDefault' => FALSE,
        'isLocked' => FALSE,
        'direction' => 'ltr',
        'weight' => 2,
        'argument' => 'es',
      ],
      3 => [
        'id' => 'pt-br',
        'name' => 'Portuguese, Brazil',
        'isDefault' => FALSE,
        'isLocked' => FALSE,
        'direction' => 'ltr',
        'weight' => 3,
        'argument' => 'pt_br',
      ],
    ],
  ], $metadata);
}