public function testPropertyReturns() { $reflectionClass = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass2'); $propertyByName = $reflectionClass->getProperty('_prop1'); $this->assertEquals('Zend_Reflection_Property', get_class($propertyByName)); $propertiesAll = $reflectionClass->getProperties(); $this->assertEquals(2, count($propertiesAll)); $firstProperty = array_shift($propertiesAll); $this->assertEquals('_prop1', $firstProperty->getName()); }
/** * @group ZF-6444 */ public function testPropertyWillLoadFromReflection() { $reflectionClass = new Zend_Reflection_Class('Zend_CodeGenerator_Php_TestClassWithManyProperties'); // test property 1 $reflProp = $reflectionClass->getProperty('_bazProperty'); $cgProp = Zend_CodeGenerator_Php_Property::fromReflection($reflProp); $this->assertEquals('_bazProperty', $cgProp->getName()); $this->assertEquals(array(true, false, true), $cgProp->getDefaultValue()->getValue()); $this->assertEquals('private', $cgProp->getVisibility()); $reflProp = $reflectionClass->getProperty('_bazStaticProperty'); // test property 2 $cgProp = Zend_CodeGenerator_Php_Property::fromReflection($reflProp); $this->assertEquals('_bazStaticProperty', $cgProp->getName()); $this->assertEquals(Zend_CodeGenerator_Php_TestClassWithManyProperties::FOO, $cgProp->getDefaultValue()->getValue()); $this->assertTrue($cgProp->isStatic()); $this->assertEquals('private', $cgProp->getVisibility()); }