function UnitTestCase::getRandomGenerator

Same name in other branches
  1. 8.9.x 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

2 calls to UnitTestCase::getRandomGenerator()
StorageComparerTest::generateRandomData in core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
Generate random data in a config storage.
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;
}

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