Issue #3358416 by Spokje, mondrake: Use RandomGeneratorTrait in UnitTestCase and remove direct implementations of randomMachineName and getRandomGenerator
parent
ca3d4fe564
commit
e1050c7be5
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue