You are here

protected function NodeLanguageTest::assertLanguageNames in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/Views/NodeLanguageTest.php \Drupal\node\Tests\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/src/Tests/Views/NodeLanguageTest.php
Tests native name display in language field.

File

core/modules/node/src/Tests/Views/NodeLanguageTest.php, line 284
Contains \Drupal\node\Tests\Views\NodeLanguageTest.

Class

NodeLanguageTest
Tests node language fields, filters, and sorting.

Namespace

Drupal\node\Tests\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.');
  }
}