You are here

protected function RandomGeneratorTrait::getRandomGenerator in Drupal 8

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

Gets the random generator for the utility methods.

Return value

\Drupal\Component\Utility\Random The random generator.

1 call to RandomGeneratorTrait::getRandomGenerator()
JsonApiFunctionalTestBase::createDefaultContent in core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php
Creates default content to test the API.

File

core/tests/Drupal/Tests/RandomGeneratorTrait.php, line 119

Class

RandomGeneratorTrait
Provides random generator utility methods.

Namespace

Drupal\Tests

Code

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