function LanguageUrlRewritingTest::testUrlRewritingEdgeCases

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

Check that non-installed languages are not considered.

File

core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php, line 70

Class

LanguageUrlRewritingTest
Tests that URL rewriting works as expected.

Namespace

Drupal\Tests\language\Functional

Code

public function testUrlRewritingEdgeCases() : void {
    // Check URL rewriting with a non-installed language.
    $non_existing = new Language([
        'id' => $this->randomMachineName(),
    ]);
    $this->checkUrl($non_existing, 'Path language is ignored if language is not installed.');
    // Check that URL rewriting is not applied to subrequests.
    $this->drupalGet('language_test/subrequest');
    $this->assertSession()
        ->pageTextContains($this->webUser
        ->getAccountName());
}

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