function NodeLanguageTest::assertLanguageNames

Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php \Drupal\Tests\node\Functional\Views\NodeLanguageTest::assertLanguageNames()
  2. 10 core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php \Drupal\Tests\node\Functional\Views\NodeLanguageTest::assertLanguageNames()
  3. 11.x 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.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.