diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php index b13dec6..7b5cd5c 100644 --- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php @@ -322,7 +322,7 @@ public function getLangcodes() { $files = scandir('core/assets/vendor/ckeditor/lang'); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*.js', $file)) { - $langcode = basename($file, 'js'); + $langcode = basename($file, '.js'); $langcodes[$langcode] = $langcode; } } diff --git a/core/modules/simpletest/src/RandomGeneratorTrait.php b/core/modules/simpletest/src/RandomGeneratorTrait.php index 51c6927..2a22de2 100644 --- a/core/modules/simpletest/src/RandomGeneratorTrait.php +++ b/core/modules/simpletest/src/RandomGeneratorTrait.php @@ -36,8 +36,18 @@ * * @see \Drupal\Component\Utility\Random::string() */ - protected function randomString($length = 8) { - return $this->getRandomGenerator()->string($length, TRUE, array($this, 'randomStringValidate')); + public function randomString($length = 8) { + if ($length < 3) { + return $this->getRandomGenerator()->string($length, TRUE, array($this, 'randomStringValidate')); + } + + // To prevent the introduction of random test failures, ensure that the + // returned string contains a character that needs to be escaped in HTML by + // injecting an ampersand into it. + $replacement_pos = floor($length / 2); + // Remove 1 from the length to account for the ampersand character. + $string = $this->getRandomGenerator()->string($length - 1, TRUE, array($this, 'randomStringValidate')); + return substr_replace($string, '&', $replacement_pos, 0); } /** @@ -51,7 +61,7 @@ protected function randomString($length = 8) { * @return bool * TRUE if the random string is valid, FALSE if not. */ - protected function randomStringValidate($string) { + public function randomStringValidate($string) { // Consecutive spaces causes issues for // \Drupal\simpletest\WebTestBase::assertLink(). if (preg_match('/\s{2,}/', $string)) { @@ -100,7 +110,7 @@ protected function randomMachineName($length = 8) { * * @see \Drupal\Component\Utility\Random::object() */ - protected function randomObject($size = 4) { + public function randomObject($size = 4) { return $this->getRandomGenerator()->object($size); } diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php index fc689d2..125a11b 100644 --- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php @@ -37,8 +37,8 @@ protected function setUp() { /** * {@inheritdoc} */ - public function containerBuild(ContainerBuilder $container) { - parent::containerBuild($container); + public function register(ContainerBuilder $container) { + parent::register($container); // Put a fake route bumper on the container to be called during uninstall. $container ->register('router.dumper', 'Drupal\Core\Routing\NullMatcherDumper'); diff --git a/core/tests/Drupal/Tests/KernelTestBase.php b/core/tests/Drupal/Tests/KernelTestBase.php index 4408485..238c3d9 100644 --- a/core/tests/Drupal/Tests/KernelTestBase.php +++ b/core/tests/Drupal/Tests/KernelTestBase.php @@ -559,7 +559,13 @@ public function register(ContainerBuilder $container) { } // @todo Remove this BC layer. - $this->containerBuild($container); + $defined_class = new \ReflectionMethod($this, 'containerBuild'); + $defined_class = $defined_class->getDeclaringClass()->name; + + if (__CLASS__ !== $defined_class) { + $this->containerBuild($container); + trigger_error('Use ::register() instead', E_USER_DEPRECATED); + } } /** @@ -570,7 +576,6 @@ public function register(ContainerBuilder $container) { * @see \Drupal\Tests\KernelTestBase::register() */ public function containerBuild(ContainerBuilder $container) { - trigger_error('Use ::register() instead', E_USER_DEPRECATED); } /**