You are here

public function RandomGeneratorTrait::randomObject in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/src/RandomGeneratorTrait.php \Drupal\simpletest\RandomGeneratorTrait::randomObject()

Generates a random PHP object.

Parameters

int $size: The number of random keys to add to the object.

Return value

\stdClass The generated object, with the specified number of random keys. Each key has a random string value.

See also

\Drupal\Component\Utility\Random::object()

3 calls to RandomGeneratorTrait::randomObject()
GarbageCollectionTest::testGarbageCollection in core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
Tests garbage collection.
StorageTestBase::setUp in core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
Performs setup tasks before each individual test method is run.
TempStoreDatabaseTest::setUp in core/modules/user/src/Tests/TempStoreDatabaseTest.php
Performs setup tasks before each individual test method is run.

File

core/modules/simpletest/src/RandomGeneratorTrait.php, line 114
Contains \Drupal\simpletest\RandomGeneratorTrait.

Class

RandomGeneratorTrait
Provides random generator utility methods.

Namespace

Drupal\simpletest

Code

public function randomObject($size = 4) {
  return $this
    ->getRandomGenerator()
    ->object($size);
}