You are here

protected function UnitTestCase::getRandomGenerator in Zircon Profile 8.0

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

File

core/tests/Drupal/Tests/UnitTestCase.php, line 76
Contains \Drupal\Tests\UnitTestCase.

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;
}