You are here

public function LanguageUrlRewritingTest::testUrlRewritingEdgeCases in Drupal 9

Same name and namespace in other branches
  1. 8 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 67

Class

LanguageUrlRewritingTest
Tests that URL rewriting works as expected.

Namespace

Drupal\Tests\language\Functional

Code

public function testUrlRewritingEdgeCases() {

  // 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());
}