Ejemplo n.º 1
0
 /**
  * @3491
  */
 public function testPropertyDocBlockWillLoadFromReflection()
 {
     $reflectionClass = new \Zend\Code\Reflection\ClassReflection('\\ZendTest\\Code\\Generator\\TestAsset\\TestClassWithManyProperties');
     $reflProp = $reflectionClass->getProperty('fooProperty');
     $cgProp = PropertyGenerator::fromReflection($reflProp);
     $this->assertEquals('fooProperty', $cgProp->getName());
     $docBlock = $cgProp->getDocBlock();
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlockGenerator', $docBlock);
     $tags = $docBlock->getTags();
     $this->assertInternalType('array', $tags);
     $this->assertEquals(1, count($tags));
     $tag = array_shift($tags);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag', $tag);
     $this->assertEquals('var', $tag->getName());
 }
Ejemplo n.º 2
0
 /**
  * @group ZF-6444
  */
 public function testPropertyWillLoadFromReflection()
 {
     $reflectionClass = new \Zend\Code\Reflection\ClassReflection('\\ZendTest\\Code\\Generator\\TestAsset\\TestClassWithManyProperties');
     // test property 1
     $reflProp = $reflectionClass->getProperty('_bazProperty');
     $cgProp = PropertyGenerator::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 = PropertyGenerator::fromReflection($reflProp);
     $this->assertEquals('_bazStaticProperty', $cgProp->getName());
     $this->assertEquals(\ZendTest\Code\Generator\TestAsset\TestClassWithManyProperties::FOO, $cgProp->getDefaultValue()->getValue());
     $this->assertTrue($cgProp->isStatic());
     $this->assertEquals('private', $cgProp->getVisibility());
 }