From e1050c7be5286d3ab7b1264107d0a6509227529a Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 5 May 2023 13:54:41 +0100 Subject: [PATCH] Issue #3358416 by Spokje, mondrake: Use RandomGeneratorTrait in UnitTestCase and remove direct implementations of randomMachineName and getRandomGenerator --- core/tests/Drupal/Tests/UnitTestCase.php | 26 +----------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php index 83f5aacc2d3..d47eef9373d 100644 --- a/core/tests/Drupal/Tests/UnitTestCase.php +++ b/core/tests/Drupal/Tests/UnitTestCase.php @@ -30,6 +30,7 @@ abstract class UnitTestCase extends TestCase { use PhpUnitCompatibilityTrait; use ProphecyTrait; use ExpectDeprecationTrait; + use RandomGeneratorTrait; /** * The app root. @@ -73,31 +74,6 @@ abstract class UnitTestCase extends TestCase { } } - /** - * Generates a unique random string containing letters and numbers. - * - * @param int $length - * Length of random string to generate. - * - * @return string - * Randomly generated unique string. - * - * @see \Drupal\Component\Utility\Random::name() - */ - public function randomMachineName($length = 8) { - return Random::machineName($length); - } - - /** - * Gets the random generator for the utility methods. - * - * @return \Drupal\Component\Utility\Random - * The random generator - */ - protected function getRandomGenerator() { - return Random::getGenerator(); - } - /** * Returns a stub config factory that behaves according to the passed array. *