/** * Tests random object generation to ensure the expected number of properties. * * @covers ::object */ public function testRandomObject() { // For values of 0 and 1 \Drupal\Component\Utility\Random::object() will // have different execution paths. $random = new Random(); for ($i = 0; $i <= 1; $i++) { $obj = $random->object($i); $this->assertEquals($i, count(get_object_vars($obj)), 'Generated random object has expected number of properties'); } }