diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml index eac36c6..1b1df51 100644 --- a/core/modules/system/tests/modules/system_test/system_test.routing.yml +++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml @@ -189,3 +189,10 @@ system_test.echo: _controller: '\Drupal\system_test\Controller\SystemTestController::simpleEcho' requirements: _access: 'TRUE' + +system_test.echo_utf8: + path: '/system-test/Ȅchȏ/{text}' + defaults: + _controller: '\Drupal\system_test\Controller\SystemTestController::simpleEcho' + requirements: + _access: 'TRUE' diff --git a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php index 906ffef..d804624 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php @@ -22,37 +22,36 @@ class CaseInsensitivePathTest extends BrowserTestBase { protected function setUp() { parent::setUp(); \Drupal::state()->set('system_test.module_hidden', FALSE); + $this->createContentType(['type' => 'page']); } /** - * Tests paths defined by routes from standard modules. + * Tests mixed case paths. */ - public function testInternalPath() { + public function testMixedCasePaths() { + // Tests paths defined by routes from standard modules as anonymous. $this->drupalGet('user/login'); - $this->assertEquals($this->getSession()->getStatusCode(), 200); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/Log in/'); + $this->drupalGet('user//login/'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/Log in/'); $this->drupalGet('User/Login'); - $this->assertEquals($this->getSession()->getStatusCode(), 200); - } + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/Log in/'); - /** - * Tests paths defined by routes from the Views module. - */ - public function testViewsPath() { + // Tests paths defined by routes from the Views module. $admin = $this->drupalCreateUser(['access administration pages', 'administer nodes', 'access content overview']); $this->drupalLogin($admin); $this->drupalGet('admin/content'); - $this->assertEquals(200, $this->getSession()->getStatusCode()); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/Content/'); $this->drupalGet('Admin/Content'); - $this->assertEquals(200, $this->getSession()->getStatusCode()); - } + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/Content/'); - /** - * Tests paths with query arguments. - */ - public function testPathsWithQuery() { - $admin = $this->drupalCreateUser(['access administration pages', 'administer nodes', 'access content overview']); - $this->drupalLogin($admin); + // Tests paths with query arguments. // Make sure our node title doesn't exist. $this->drupalGet('admin/content'); @@ -85,6 +84,14 @@ public function testPathsWithQuery() { $this->assertSession()->linkExists('FooBarBaz'); $this->assertSession()->linkByHrefExists($node->toUrl()->toString()); $this->assertSession()->fieldValueEquals('edit-title', 'FooBarBaz'); + // Check that we can access the node with a mixed case path. + $this->drupalGet('NOdE/' . $node->id()); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/FooBarBaz/'); + // Check that we can access the node with a mixed case path and extra slash. + $this->drupalGet('Node//' . $node->id()); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/FooBarBaz/'); } /** @@ -92,12 +99,22 @@ public function testPathsWithQuery() { */ public function testPathsWithArguments() { $this->drupalGet('system-test/echo/foobarbaz'); - $this->assertSession()->responseMatches('/foobarbaz/'); - $this->assertSession()->responseNotMatches('/FooBarBaz/'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/foobarbaz/'); + $this->assertSession()->pageTextNotMatches('/FooBarBaz/'); $this->drupalGet('system-test/echo/FooBarBaz'); - $this->assertSession()->responseMatches('/FooBarBaz/'); - $this->assertSession()->responseNotMatches('/foobarbaz/'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/FooBarBaz/'); + $this->assertSession()->pageTextNotMatches('/foobarbaz/'); + + // Test utf-8 characters in the route path. + $this->drupalGet('/system-test/Ȅchȏ/ABc123'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/ABc123/'); + $this->drupalGet('/system-test/ȅchȎ/ABc123'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextMatches('/ABc123/'); } }