You are here

protected function UnitTestCase::getRandomGenerator in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getRandomGenerator()

Gets the random generator for the utility methods.

Return value

\Drupal\Component\Utility\Random The random generator

1 call to UnitTestCase::getRandomGenerator()
StorageCopyTraitTest::generateRandomData in core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php
Generate random data in a config storage.

File

core/tests/Drupal/Tests/UnitTestCase.php, line 93

Class

UnitTestCase
Provides a base class and helpers for Drupal unit tests.

Namespace

Drupal\Tests

Code

protected function getRandomGenerator() {
  if (!is_object($this->randomGenerator)) {
    $this->randomGenerator = new Random();
  }
  return $this->randomGenerator;
}