getObjectAttribute() public static method

This also works for attributes that are declared protected or private.
public static getObjectAttribute ( object $object, string $attributeName ) : mixed
$object object
$attributeName string
return mixed
Esempio n. 1
0
 public function testAddExtension()
 {
     $factory = new Factory(M::mock('Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface'));
     $extension = M::mock('Knp\\Menu\\Factory\\ExtensionInterface');
     $factory->addExtension($extension);
     $this->assertCount(3, \PHPUnit_Framework_Assert::getObjectAttribute($factory, 'extensions'));
 }
 public function testLoggerNotGiven()
 {
     $swarm = new SwarmProcess();
     $this->assertInstanceOf('Psr\\Log\\NullLogger', \PHPUnit_Framework_Assert::getObjectAttribute($swarm, 'logger'), 'Logger expected when none is given, should be the NullLogger');
 }