You are here

protected function RandomGeneratorTrait::getRandomGenerator in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::getRandomGenerator()
  2. 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.

3 calls to RandomGeneratorTrait::getRandomGenerator()
CommentAdminTest::testApprovalAdminInterface in core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
Tests comment approval functionality through admin/content/comment.
FileStorageFactoryTest::testGetSync in core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php
@covers ::getSync
MenuLinkTest::providerSource in core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/MenuLinkTest.php
The data provider.

File

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

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