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..9e048b5 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; /** @@ -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); 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/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".