You are here

protected function NodeLanguageTest::assertLanguageNames in Drupal 10

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()
  2. 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.

@internal

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(bool $native = FALSE) : void {
  $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');
  }
}