You are here

public function LanguageUrlRewritingTest::testUrlRewritingEdgeCases in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php \Drupal\Tests\language\Functional\LanguageUrlRewritingTest::testUrlRewritingEdgeCases()
  2. 10 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 65

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
    ->assertText($this->webUser
    ->getAccountName(), 'Page correctly retrieved');
}