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

Generates a random PHP object.

Parameters

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

Return value

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

See also

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

File

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

Class

RandomGeneratorTrait
Provides random generator utility methods.

Namespace

Drupal\Tests

Code

public function randomObject($size = 4) {
  return Random::object($size);
}