function LanguagePathMonolingualTest::testPageLinks

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php \Drupal\Tests\language\Functional\LanguagePathMonolingualTest::testPageLinks()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php \Drupal\Tests\language\Functional\LanguagePathMonolingualTest::testPageLinks()
  3. 10 core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php \Drupal\Tests\language\Functional\LanguagePathMonolingualTest::testPageLinks()

Verifies that links do not have language prefixes in them.

File

core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php, line 76

Class

LanguagePathMonolingualTest
Confirm that paths are not changed on monolingual non-English sites.

Namespace

Drupal\Tests\language\Functional

Code

public function testPageLinks() : void {
    // Navigate to 'admin/config' path.
    $this->drupalGet('admin/config');
    // Verify that links in this page do not have a 'fr/' prefix.
    $this->assertSession()
        ->linkByHrefNotExists('/fr/', 'Links do not contain language prefix');
    // Verify that links in this page can be followed and work.
    $this->clickLink('Languages');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextContains('Add language');
}

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