You are here

protected function NodeLanguageTest::assertLanguageNames in Drupal 9

Same name and namespace in other branches
  1. 8 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 285

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
      ->assertSession()
      ->pageTextContains('Français');
    $this
      ->assertSession()
      ->pageTextContains('Español');
    $this
      ->assertSession()
      ->pageTextNotContains('French');
    $this
      ->assertSession()
      ->pageTextNotContains('Spanish');
  }
  else {
    $this
      ->assertSession()
      ->pageTextNotContains('Français');
    $this
      ->assertSession()
      ->pageTextNotContains('Español');
    $this
      ->assertSession()
      ->pageTextContains('French');
    $this
      ->assertSession()
      ->pageTextContains('Spanish');
  }
}