You are here

protected function NodeLanguageTest::assertLanguageNames in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php \Drupal\Tests\node\Functional\Views\NodeLanguageTest::assertLanguageNames()

Asserts the presence of language names in their English or native forms.

Parameters

bool $native: (optional) Whether to assert the language name in its native form.

1 call to NodeLanguageTest::assertLanguageNames()
NodeLanguageTest::testNativeLanguageField in core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php
Tests native name display in language field.

File

core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php, line 287

Class

NodeLanguageTest
Tests node language fields, filters, and sorting.

Namespace

Drupal\Tests\node\Functional\Views

Code

protected function assertLanguageNames($native = FALSE) {
  $this
    ->drupalGet('test-language');
  if ($native) {
    $this
      ->assertText('Français', 'French language shown in native form.');
    $this
      ->assertText('Español', 'Spanish language shown in native form.');
    $this
      ->assertNoText('French', 'French language not shown in English.');
    $this
      ->assertNoText('Spanish', 'Spanish language not shown in English.');
  }
  else {
    $this
      ->assertNoText('Français', 'French language not shown in native form.');
    $this
      ->assertNoText('Español', 'Spanish language not shown in native form.');
    $this
      ->assertText('French', 'French language shown in English.');
    $this
      ->assertText('Spanish', 'Spanish language shown in English.');
  }
}