function NodeLanguageTest::assertLanguageNames

Same name in other branches
  1. 8.9.x 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.

@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');
    }
}

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