public function testRealize() { $this->property->setVisibility('private')->setStatic(true); $this->assertEquals('private static $prop', $this->realizer->realize($this->property)); $this->property->setDefaultValue('default'); $this->assertEquals('private static $prop = mockedDefValue', $this->realizer->realize($this->property), 'Realization with sting default value'); }
/** * @param \ReflectionProperty $property * @return Property */ public function property(\ReflectionProperty $property) { $phpyProperty = new Property($property->getName()); $phpyProperty->setStatic($property->isStatic()); $refClass = $property->getDeclaringClass(); $defClassValues = $refClass->getDefaultProperties(); if (isset($defClassValues[$property->getName()])) { $phpyProperty->setDefaultValue($defClassValues[$property->getName()]); } if ($property->isPublic()) { $phpyProperty->setVisibility('public'); } elseif ($property->isProtected()) { $phpyProperty->setVisibility('protected'); } else { $phpyProperty->setVisibility('private'); } return $phpyProperty; }
/** * @expectedException \OutOfBoundsException */ public function testSetInvalidVisibility() { $this->property->setVisibility('xxx'); }