public function RandomGeneratorTrait::randomObject in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomObject()
- 10 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()
4 calls to RandomGeneratorTrait::randomObject()
- GarbageCollectionTest::testGarbageCollection in core/
tests/ Drupal/ KernelTests/ Core/ KeyValueStore/ GarbageCollectionTest.php - Tests garbage collection.
- StorageTestBase::setUp in core/
tests/ Drupal/ KernelTests/ Core/ KeyValueStore/ StorageTestBase.php - TempStoreDatabaseTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ TempStore/ TempStoreDatabaseTest.php - TempStoreDatabaseTest::setUp in core/
modules/ user/ tests/ src/ Kernel/ TempStoreDatabaseTest.php
File
- core/
tests/ Drupal/ Tests/ RandomGeneratorTrait.php, line 109
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\TestsCode
public function randomObject($size = 4) {
return $this
->getRandomGenerator()
->object($size);
}