You are here

public function LanguageTest::testLanguageSwitchLinks in GraphQL 8.3

Test language switch links.

File

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

Class

LanguageTest
Test multilingual behavior.

Namespace

Drupal\Tests\graphql_core\Kernel\Languages

Code

public function testLanguageSwitchLinks() {
  $metadata = $this
    ->defaultCacheMetaData();
  $metadata
    ->addCacheTags([
    'config:language.entity.en',
    'config:language.entity.es',
    'config:language.entity.fr',
    'config:language.entity.pt-br',
  ]);
  $this
    ->assertResults($this
    ->getQueryFromFile('language_switch_links.gql'), [], [
    'route' => [
      'links' => [
        0 => [
          'language' => [
            'id' => 'en',
          ],
          'url' => [
            'path' => '/en',
          ],
          'title' => 'English',
          'active' => TRUE,
        ],
        1 => [
          'language' => [
            'id' => 'fr',
          ],
          'url' => [
            'path' => '/fr',
          ],
          'title' => NULL,
          'active' => FALSE,
        ],
        2 => [
          'language' => [
            'id' => 'es',
          ],
          'url' => [
            'path' => '/es',
          ],
          'title' => NULL,
          'active' => FALSE,
        ],
        3 => [
          'language' => [
            'id' => 'pt-br',
          ],
          'url' => [
            'path' => '/',
          ],
          'title' => NULL,
          'active' => FALSE,
        ],
      ],
    ],
  ], $metadata);
}