public function RandomGeneratorTrait::randomObject in Drupal 9
Same name and namespace in other branches
- 8 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()
3 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::testSharedTempStore in core/
tests/ Drupal/ KernelTests/ Core/ TempStore/ TempStoreDatabaseTest.php - Tests the SharedTempStore API.
File
- core/
tests/ Drupal/ Tests/ RandomGeneratorTrait.php, line 108
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\TestsCode
public function randomObject($size = 4) {
return $this
->getRandomGenerator()
->object($size);
}