Example #1
0
 public function testProperty()
 {
     $class = new ReflectionClass(__NAMESPACE__ . '\\TestClass');
     $gClass = GClass::reflectorFactory($class);
     $prop1 = GProperty::reflectorFactory($class->getProperty('prop1'), $gClass);
     $this->assertEquals(TRUE, $prop1->hasDefaultValue(), 'hasDefaultValue');
     $this->assertEquals('prop1', $prop1->getName());
     $this->assertEquals('banane', $prop1->getDefaultValue());
     $this->assertEquals(TRUE, $prop1->isProtected());
     $this->assertEquals("protected \$prop1 = 'banane'", $prop1->php());
     $prop2 = GProperty::reflectorFactory($class->getProperty('prop2'), $gClass);
     //$this->assertEquals(FALSE, $prop2->hasDefaultValue(), 'hasDefaultValue'); // php bug? hier gibt reflection TRUE als isDefault aus
     $this->assertEquals('prop2', $prop2->getName());
     $this->assertEquals(FALSE, $prop2->isProtected());
     $this->assertEquals(TRUE, $prop2->isPublic());
     $this->assertEquals(TRUE, $prop2->isStatic());
     $this->assertEquals("public static \$prop2", $prop2->php());
 }
Example #2
0
 public function removeDefaultValue(GProperty $property)
 {
     if (array_key_exists($n = $property->getName(), $this->defaultProperties)) {
         unset($this->defaultProperties[$n]);
     }
 }