Issue #3358416 by Spokje, mondrake: Use RandomGeneratorTrait in UnitTestCase and remove direct implementations of randomMachineName and getRandomGenerator

merge-requests/3945/head
catch 2023-05-05 13:54:41 +01:00
parent ca3d4fe564
commit e1050c7be5
1 changed files with 1 additions and 25 deletions

View File

@ -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.
*