function UnitTestCase::getRandomGenerator

Same name and namespace in other branches
  1. 9 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 76

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.