Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
 /**
  * @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;
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \OutOfBoundsException
  */
 public function testSetInvalidVisibility()
 {
     $this->property->setVisibility('xxx');
 }