diff --git a/core/lib/Drupal/Core/Path/AliasStorage.php b/core/lib/Drupal/Core/Path/AliasStorage.php index 899c39e..b9f65fe 100644 --- a/core/lib/Drupal/Core/Path/AliasStorage.php +++ b/core/lib/Drupal/Core/Path/AliasStorage.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Path; use Drupal\Core\Cache\Cache; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Database\Connection; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageInterface; @@ -59,7 +60,7 @@ public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NO $fields = array( 'source' => $source, - 'alias' => $alias, + 'alias' => Unicode::strtolower($alias), 'langcode' => $langcode, ); @@ -98,6 +99,9 @@ public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NO public function load($conditions) { $select = $this->connection->select('url_alias'); foreach ($conditions as $field => $value) { + if ($field == 'alias') { + $value = Unicode::strtolower($value); + } $select->condition($field, $value); } return $select @@ -115,6 +119,9 @@ public function delete($conditions) { $path = $this->load($conditions); $query = $this->connection->delete('url_alias'); foreach ($conditions as $field => $value) { + if ($field == 'alias') { + $value = Unicode::strtolower($value); + } $query->condition($field, $value); } $deleted = $query->execute(); @@ -184,7 +191,7 @@ public function lookupPathAlias($path, $langcode) { */ public function lookupPathSource($path, $langcode) { $args = array( - ':alias' => $path, + ':alias' => Unicode::strtolower($path), ':langcode' => $langcode, ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); @@ -208,7 +215,7 @@ public function lookupPathSource($path, $langcode) { */ public function aliasExists($alias, $langcode, $source = NULL) { $query = $this->connection->select('url_alias') - ->condition('alias', $alias) + ->condition('alias', Unicode::strtolower($alias)) ->condition('langcode', $langcode); if (!empty($source)) { $query->condition('source', $source, '<>'); @@ -234,7 +241,7 @@ public function getAliasesForAdminListing($header, $keys = NULL) { ->extend('Drupal\Core\Database\Query\TableSortExtender'); if ($keys) { // Replace wildcards with PDO wildcards. - $query->condition('alias', '%' . preg_replace('!\*+!', '%', $keys) . '%', 'LIKE'); + $query->condition('alias', '%' . preg_replace('!\*+!', '%', Unicode::strtolower($keys)) . '%', 'LIKE'); } return $query ->fields('url_alias') diff --git a/core/lib/Drupal/Core/Path/AliasStorageInterface.php b/core/lib/Drupal/Core/Path/AliasStorageInterface.php index 5ac77a3..5d22b46 100644 --- a/core/lib/Drupal/Core/Path/AliasStorageInterface.php +++ b/core/lib/Drupal/Core/Path/AliasStorageInterface.php @@ -20,7 +20,7 @@ * @param string $source * The internal system path. * @param string $alias - * The URL alias. + * The URL alias. This will be converted to lower case. * @param string $langcode * (optional) The language code of the alias. * @param int|null $pid @@ -97,7 +97,8 @@ public function lookupPathAlias($path, $langcode); * Returns Drupal system URL of an alias. * * @param string $path - * The path to investigate for corresponding system URLs. + * The path to investigate for corresponding system URLs. This will be + * converted to lower case. * @param string $langcode * Language code to search the path with. If there's no path defined for * that language it will search paths without language. @@ -111,7 +112,7 @@ public function lookupPathSource($path, $langcode); * Checks if alias already exists. * * @param string $alias - * Alias to check against. + * Alias to check against. This will be converted to lower case. * @param string $langcode * Language of the alias. * @param string|null $source @@ -135,8 +136,9 @@ public function languageAliasExists(); * * @param array $header * Table header. - * @param string[]|null $keys - * (optional) Search keys. + * @param string|null $keys + * (optional) Search keyword that may include one or more '*' as a wildcard + * value. Will be converted to lower case. * * @return array * Array of items to be displayed on the current page. diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php index a78cf0c..0404cd4 100644 --- a/core/lib/Drupal/Core/Routing/RouteBuilder.php +++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Routing; use Drupal\Component\Discovery\YamlDiscovery; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Access\CheckProviderInterface; use Drupal\Core\Controller\ControllerResolverInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -174,7 +175,9 @@ public function rebuild() { 'condition' => '', ); - $route = new Route($route_info['path'], $route_info['defaults'], $route_info['requirements'], $route_info['options'], $route_info['host'], $route_info['schemes'], $route_info['methods'], $route_info['condition']); + // Lowercase the path here so that the events get a consistent path, + // even though we force them all to be lower later. + $route = new Route(Unicode::strtolower($route_info['path']), $route_info['defaults'], $route_info['requirements'], $route_info['options'], $route_info['host'], $route_info['schemes'], $route_info['methods'], $route_info['condition']); $collection->add($name, $route); } } @@ -182,11 +185,15 @@ public function rebuild() { // DYNAMIC is supposed to be used to add new routes based upon all the // static defined ones. $this->dispatcher->dispatch(RoutingEvents::DYNAMIC, new RouteBuildEvent($collection)); + // Process the whole collection since we cannot tell what was newly added. + $this->processCollection($collection); // ALTER is the final step to alter all the existing routes. We cannot stop // people from adding new routes here, but we define two separate steps to // make it clear. $this->dispatcher->dispatch(RoutingEvents::ALTER, new RouteBuildEvent($collection)); + // Process the whole collection again since we cannot tell what was changed. + $this->processCollection($collection); $this->checkProvider->setChecks($collection); @@ -221,6 +228,20 @@ public function destruct() { // user. $this->rebuildIfNeeded(); } + /** + * Apply additional processing to each route in the collection. + * + * @param \Symfony\Component\Routing\RouteCollection $collection + * A route collection. + */ + protected function processCollection(RouteCollection $collection) { + /** @var \Symfony\Component\Routing\Route $route */ + foreach ($collection as $route) { + // Force each path to be lower case. + $path = Unicode::strtolower($route->getPath()); + $route->setPath($path); + } + } /** * Retrieves all defined routes from .routing.yml files. diff --git a/core/lib/Drupal/Core/Routing/RouteCompiler.php b/core/lib/Drupal/Core/Routing/RouteCompiler.php index 639feff..e574743 100644 --- a/core/lib/Drupal/Core/Routing/RouteCompiler.php +++ b/core/lib/Drupal/Core/Routing/RouteCompiler.php @@ -53,7 +53,8 @@ public static function compile(Route $route) { $num_parts, // These are the Symfony compiled parts. $symfony_compiled->getStaticPrefix(), - $symfony_compiled->getRegex(), + // Append the case-insensitive modifier to the regex. + $symfony_compiled->getRegex() . 'i', $symfony_compiled->getTokens(), $symfony_compiled->getPathVariables(), $symfony_compiled->getHostRegex(), diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 58b8320..6602247 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -10,6 +10,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\State\StateInterface; @@ -149,7 +150,8 @@ public function __construct(Connection $connection, StateInterface $state, Curre */ public function getRouteCollectionForRequest(Request $request) { // Cache both the system path as well as route parameters and matching - // routes. + // routes. We can not yet convert the path to lower case since path portions + // corresponding to path slugs may be case sensitive. $cid = 'route:' . $request->getPathInfo() . ':' . $request->getQueryString(); if ($cached = $this->cache->get($cid)) { $this->currentPath->setPath($cached->data['path'], $request); @@ -157,9 +159,9 @@ public function getRouteCollectionForRequest(Request $request) { return $cached->data['routes']; } else { - // Just trim on the right side. $path = $request->getPathInfo(); - $path = $path === '/' ? $path : rtrim($request->getPathInfo(), '/'); + // Just trim on the right side. + $path = $path === '/' ? $path : rtrim($path, '/'); $path = $this->pathProcessor->processInbound($path, $request); $this->currentPath->setPath($path, $request); // Incoming path processors may also set query parameters. @@ -319,7 +321,8 @@ public function getRoutesByPattern($pattern) { * Get all routes which match a certain pattern. * * @param string $path - * The route pattern to search for (contains % as placeholders). + * The route pattern to search for (contains % as placeholders). Must be + * lower case. * * @return \Symfony\Component\Routing\RouteCollection * Returns a route collection of matching routes. @@ -327,7 +330,7 @@ public function getRoutesByPattern($pattern) { protected function getRoutesByPath($path) { // Split the path up on the slashes, ignoring multiple slashes in a row // or leading or trailing slashes. - $parts = preg_split('@/+@', $path, NULL, PREG_SPLIT_NO_EMPTY); + $parts = preg_split('@/+@', Unicode::strtolower($path), NULL, PREG_SPLIT_NO_EMPTY); $collection = new RouteCollection(); diff --git a/core/lib/Drupal/Core/Routing/UrlMatcher.php b/core/lib/Drupal/Core/Routing/UrlMatcher.php index 49bff8f..0b97f0a 100644 --- a/core/lib/Drupal/Core/Routing/UrlMatcher.php +++ b/core/lib/Drupal/Core/Routing/UrlMatcher.php @@ -46,4 +46,72 @@ public function finalMatch(RouteCollection $collection, Request $request) { return $this->match($this->currentPath->getPath($request)); } + /** + * Tries to match a URL with a set of routes. + * + * This version differe from the Symfony parent version in two respects. + * First, the $pathinfo string is converted to lower case. In addition, we + * remove the check against any static prefix since we would already have + * matched the static prefix in \Drupal\Core\Routing\RouteProvider before + * arriving here. + * + * @param string $pathinfo + * The path info to be parsed + * @param RouteCollection $routes + * The set of routes + * + * @return array An array of parameters + * + * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException + * If the resource could not be found + * @throws \Symfony\Component\Routing\Exception\MethodNotAllowedException + * If the resource was found but the request method is not allowed + */ + protected function matchCollection($pathinfo, RouteCollection $routes) + { + + foreach ($routes as $name => $route) { + $compiledRoute = $route->compile(); + + // We use a case-insensitive comparison. It would be more consistent + // to convert the path to lower case, but this breaks cases where + // a path slug receives base64 encoded data. + // @see \Drupal\Core\Routing\RouteCompiler::compile() + if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { + continue; + } + + $hostMatches = array(); + if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { + continue; + } + + // check HTTP method requirement + if ($requiredMethods = $route->getMethods()) { + // HEAD and GET are equivalent as per RFC + if ('HEAD' === $method = $this->context->getMethod()) { + $method = 'GET'; + } + + if (!in_array($method, $requiredMethods)) { + $this->allow = array_merge($this->allow, $requiredMethods); + + continue; + } + } + + $status = $this->handleRouteRequirements($pathinfo, $name, $route); + + if (self::ROUTE_MATCH === $status[0]) { + return $status[1]; + } + + if (self::REQUIREMENT_MISMATCH === $status[0]) { + continue; + } + + return $this->getAttributes($route, $name, array_replace($matches, $hostMatches)); + } + } + } diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php index 3048e01..ceb98c4 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php @@ -8,6 +8,7 @@ namespace Drupal\config_translation\Tests; use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\Unicode; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\WebTestBase; @@ -95,7 +96,7 @@ public function testMapperListPage() { foreach ($labels as $label) { $test_entity = entity_create('config_test', array( - 'id' => $this->randomMachineName(), + 'id' => Unicode::strtolower($this->randomMachineName()), 'label' => $label, )); $test_entity->save(); diff --git a/core/modules/locale/src/Tests/LocalePathTest.php b/core/modules/locale/src/Tests/LocalePathTest.php index 820814e..b04d4e3 100644 --- a/core/modules/locale/src/Tests/LocalePathTest.php +++ b/core/modules/locale/src/Tests/LocalePathTest.php @@ -7,6 +7,7 @@ namespace Drupal\locale\Tests; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; @@ -72,7 +73,7 @@ public function testPathLanguageConfiguration() { // Create a path alias in default language (English). $path = 'admin/config/search/path/add'; - $english_path = $this->randomMachineName(8); + $english_path = Unicode::strtolower($this->randomMachineName(8)); $edit = array( 'source' => '/node/' . $node->id(), 'alias' => '/' . $english_path, @@ -81,7 +82,7 @@ public function testPathLanguageConfiguration() { $this->drupalPostForm($path, $edit, t('Save')); // Create a path alias in new custom language. - $custom_language_path = $this->randomMachineName(8); + $custom_language_path = Unicode::strtolower($this->randomMachineName(8)); $edit = array( 'source' => '/node/' . $node->id(), 'alias' => '/' . $custom_language_path, @@ -98,7 +99,7 @@ public function testPathLanguageConfiguration() { $this->assertText($node->label(), 'Custom language alias works.'); // Create a custom path. - $custom_path = $this->randomMachineName(8); + $custom_path = Unicode::strtolower($this->randomMachineName(8)); // Check priority of language for alias by source path. $edit = array( diff --git a/core/modules/path/src/Tests/PathAliasTest.php b/core/modules/path/src/Tests/PathAliasTest.php index 651c11f..2b74562 100644 --- a/core/modules/path/src/Tests/PathAliasTest.php +++ b/core/modules/path/src/Tests/PathAliasTest.php @@ -7,6 +7,7 @@ namespace Drupal\path\Tests; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Cache\Cache; /** @@ -75,7 +76,7 @@ function testAdminAlias() { // Create alias. $edit = array(); $edit['source'] = '/node/' . $node1->id(); - $edit['alias'] = '/' . $this->randomMachineName(8); + $edit['alias'] = '/' . Unicode::strtolower($this->randomMachineName(8)); $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); // Confirm that the alias works. @@ -126,7 +127,7 @@ function testAdminAlias() { // Create a really long alias. $edit = array(); $edit['source'] = '/node/' . $node1->id(); - $alias = '/' . $this->randomMachineName(128); + $alias = '/' . Unicode::strtolower($this->randomMachineName(128)); $edit['alias'] = $alias; // The alias is shortened to 50 characters counting the ellipsis. $truncated_alias = substr($alias, 0, 47); @@ -141,7 +142,7 @@ function testAdminAlias() { // Create absolute path alias. $edit = array(); $edit['source'] = '/node/' . $node3->id(); - $node3_alias = '/' . $this->randomMachineName(8); + $node3_alias = '/' . Unicode::strtolower($this->randomMachineName(8)); $edit['alias'] = $node3_alias; $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); @@ -151,7 +152,7 @@ function testAdminAlias() { // Create alias with trailing slash. $edit = array(); $edit['source'] = '/node/' . $node4->id(); - $node4_alias = '/' . $this->randomMachineName(8); + $node4_alias = '/' . Unicode::strtolower($this->randomMachineName(8)); $edit['alias'] = $node4_alias . '/'; $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); @@ -185,7 +186,7 @@ function testAdminAlias() { $edit = array(); $edit['source'] = 'node/' . $node5->id(); - $node5_alias = $this->randomMachineName(8); + $node5_alias = Unicode::strtolower($this->randomMachineName(8)); $edit['alias'] = $node5_alias . '/'; $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); @@ -203,7 +204,7 @@ function testNodeAlias() { // Create alias. $edit = array(); - $edit['path[0][alias]'] = '/' . $this->randomMachineName(8); + $edit['path[0][alias]'] = '/' . Unicode::strtolower($this->randomMachineName(8)); $this->drupalPostForm('node/' . $node1->id() . '/edit', $edit, t('Save')); // Confirm that the alias works. diff --git a/core/modules/path/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php index 67463f2..0b159f3 100644 --- a/core/modules/path/src/Tests/PathLanguageTest.php +++ b/core/modules/path/src/Tests/PathLanguageTest.php @@ -7,6 +7,8 @@ namespace Drupal\path\Tests; +use Drupal\Component\Utility\Unicode; + /** * Confirm that paths work with translated nodes. * @@ -79,7 +81,7 @@ protected function setUp() { function testAliasTranslation() { $node_storage = $this->container->get('entity.manager')->getStorage('node'); $english_node = $this->drupalCreateNode(array('type' => 'page', 'langcode' => 'en')); - $english_alias = $this->randomMachineName(); + $english_alias = Unicode::strtolower($this->randomMachineName()); // Edit the node to set language and path. $edit = array(); @@ -97,7 +99,7 @@ function testAliasTranslation() { $edit = array(); $edit['title[0][value]'] = $this->randomMachineName(); $edit['body[0][value]'] = $this->randomMachineName(); - $french_alias = $this->randomMachineName(); + $french_alias = Unicode::strtolower($this->randomMachineName()); $edit['path[0][alias]'] = '/' . $french_alias; $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); @@ -125,7 +127,7 @@ function testAliasTranslation() { $languages = $this->container->get('language_manager')->getLanguages(); $url = $english_node_french_translation->url('canonical', array('language' => $languages['fr'])); - $this->assertTrue(strpos($url, $edit['path[0][alias]']), 'URL contains the path alias.'); + $this->assertTrue(strpos($url, Unicode::strtolower($edit['path[0][alias]'])), 'URL contains the path alias.'); // Confirm that the alias works even when changing language negotiation // options. Enable User language detection and selection over URL one. diff --git a/core/modules/path/src/Tests/PathTaxonomyTermTest.php b/core/modules/path/src/Tests/PathTaxonomyTermTest.php index 98372df..b545323 100644 --- a/core/modules/path/src/Tests/PathTaxonomyTermTest.php +++ b/core/modules/path/src/Tests/PathTaxonomyTermTest.php @@ -7,6 +7,7 @@ namespace Drupal\path\Tests; +use Drupal\Component\Utility\Unicode; use Drupal\taxonomy\Entity\Vocabulary; /** @@ -48,7 +49,7 @@ function testTermAlias() { $edit = array( 'name[0][value]' => $this->randomMachineName(), 'description[0][value]' => $description, - 'path[0][alias]' => '/' . $this->randomMachineName(), + 'path[0][alias]' => '/' . Unicode::strtolower($this->randomMachineName()), ); $this->drupalPostForm('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add', $edit, t('Save')); $tid = db_query("SELECT tid FROM {taxonomy_term_field_data} WHERE name = :name AND default_langcode = 1", array(':name' => $edit['name[0][value]']))->fetchField(); diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 9ef0a66..8df922b 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -10,6 +10,7 @@ use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Xss; use Drupal\Core\Render\RenderContext; use Symfony\Component\CssSelector\CssSelector; @@ -359,7 +360,7 @@ protected function assertNoLink($label, $message = '', $group = 'Other') { * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertLinkByHref($href, $index = 0, $message = '', $group = 'Other') { - $links = $this->xpath('//a[contains(@href, :href)]', array(':href' => $href)); + $links = $this->xpath('//a[contains(@href, :href)]', array(':href' => Unicode::strtolower($href))); $message = ($message ? $message : SafeMarkup::format('Link containing href %href found.', array('%href' => $href))); return $this->assert(isset($links[$index]), $message, $group); } @@ -384,7 +385,7 @@ protected function assertLinkByHref($href, $index = 0, $message = '', $group = ' * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNoLinkByHref($href, $message = '', $group = 'Other') { - $links = $this->xpath('//a[contains(@href, :href)]', array(':href' => $href)); + $links = $this->xpath('//a[contains(@href, :href)]', array(':href' => Unicode::strtolower($href))); $message = ($message ? $message : SafeMarkup::format('No link containing href %href found.', array('%href' => $href))); return $this->assert(empty($links), $message, $group); } diff --git a/core/modules/system/src/Tests/Menu/MenuRouterTest.php b/core/modules/system/src/Tests/Menu/MenuRouterTest.php index 21052a4..6d222d2 100644 --- a/core/modules/system/src/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/src/Tests/Menu/MenuRouterTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Menu; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; @@ -65,7 +66,7 @@ public function testMenuIntegration() { */ protected function doTestHookMenuIntegration() { // Generate base path with random argument. - $machine_name = $this->randomMachineName(8); + $machine_name = Unicode::strtolower($this->randomMachineName(8)); $base_path = 'foo/' . $machine_name; $this->drupalGet($base_path); // Confirm correct controller activated. diff --git a/core/modules/system/src/Tests/Path/AliasTest.php b/core/modules/system/src/Tests/Path/AliasTest.php index 2ceb4c9..76cd859 100644 --- a/core/modules/system/src/Tests/Path/AliasTest.php +++ b/core/modules/system/src/Tests/Path/AliasTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Path; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Cache\MemoryCounterBackend; use Drupal\Core\Path\AliasStorage; use Drupal\Core\Database\Database; @@ -107,7 +108,8 @@ function testLookupPath() { $aliasStorage->save($path['source'], $path['alias'], $path['langcode']); // Hook that clears cache is not executed with unit tests. \Drupal::service('path.alias_manager')->cacheClear(); - $this->assertEqual($aliasManager->getAliasByPath($path['source']), $path['alias'], 'English alias overrides language-neutral alias.'); + + $this->assertEqual($aliasManager->getAliasByPath($path['source']), Unicode::strtolower($path['alias']), 'English alias overrides language-neutral alias.'); $this->assertEqual($aliasManager->getPathByAlias($path['alias']), $path['source'], 'English source overrides language-neutral source.'); // Create a language-neutral alias for the same path, again. @@ -127,7 +129,7 @@ function testLookupPath() { $aliasStorage->save($path['source'], $path['alias'], $path['langcode']); $this->assertEqual($aliasManager->getAliasByPath($path['source']), "/users/Dries", 'English alias still returned after entering a LOLspeak alias.'); // The LOLspeak alias should be returned if we really want LOLspeak. - $this->assertEqual($aliasManager->getAliasByPath($path['source'], 'xx-lolspeak'), '/LOL', 'LOLspeak alias returned if we specify xx-lolspeak to the alias manager.'); + $this->assertEqual($aliasManager->getAliasByPath($path['source'], 'xx-lolspeak'), '/lol', 'LOLspeak alias returned if we specify xx-lolspeak to the alias manager.'); // Create a new alias for this path in English, which should override the // previous alias for "user/1". diff --git a/core/modules/views/src/Tests/Wizard/BasicTest.php b/core/modules/views/src/Tests/Wizard/BasicTest.php index d84722b..e8153e0 100644 --- a/core/modules/views/src/Tests/Wizard/BasicTest.php +++ b/core/modules/views/src/Tests/Wizard/BasicTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Url; use Drupal\views\Views; @@ -60,9 +61,9 @@ function testViewsWizardAndListing() { $view2['description'] = $this->randomMachineName(16); $view2['page[create]'] = 1; $view2['page[title]'] = $this->randomMachineName(16); - $view2['page[path]'] = $this->randomMachineName(16); + $view2['page[path]'] = Unicode::strtolower($this->randomMachineName(16)); $view2['page[feed]'] = 1; - $view2['page[feed_properties][path]'] = $this->randomMachineName(16); + $view2['page[feed_properties][path]'] = Unicode::strtolower($this->randomMachineName(16)); $this->drupalPostForm('admin/structure/views/add', $view2, t('Save and edit')); $this->drupalGet($view2['page[path]']); $this->assertResponse(200); @@ -109,7 +110,7 @@ function testViewsWizardAndListing() { $view3['show[type]'] = 'page'; $view3['page[create]'] = 1; $view3['page[title]'] = $this->randomMachineName(16); - $view3['page[path]'] = $this->randomMachineName(16); + $view3['page[path]'] = Unicode::strtolower($this->randomMachineName(16)); $view3['block[create]'] = 1; $view3['block[title]'] = $this->randomMachineName(16); $this->drupalPostForm('admin/structure/views/add', $view3, t('Save and edit')); diff --git a/core/modules/views/src/Tests/Wizard/MenuTest.php b/core/modules/views/src/Tests/Wizard/MenuTest.php index af6a98d..ffae5bc 100644 --- a/core/modules/views/src/Tests/Wizard/MenuTest.php +++ b/core/modules/views/src/Tests/Wizard/MenuTest.php @@ -8,6 +8,7 @@ namespace Drupal\views\Tests\Wizard; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Url; /** @@ -30,7 +31,7 @@ function testMenus() { $view['description'] = $this->randomMachineName(16); $view['page[create]'] = 1; $view['page[title]'] = $this->randomMachineName(16); - $view['page[path]'] = $this->randomMachineName(16); + $view['page[path]'] = Unicode::strtolower($this->randomMachineName(16)); $view['page[link]'] = 1; $view['page[link_properties][menu_name]'] = 'main'; $view['page[link_properties][title]'] = $this->randomMachineName(16);