Beispiel #1
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @var string');
     $reflectionTag = $docreflection->getTag('var');
     /** @var GenericTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\GenericTag', $tag);
     $this->assertEquals('var', $tag->getName());
     $this->assertEquals('string', $tag->getContent());
 }
Beispiel #2
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @license http://zend.com License');
     $reflectionTag = $docreflection->getTag('license');
     /** @var LicenseTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\LicenseTag', $tag);
     $this->assertEquals('http://zend.com', $tag->getUrl());
     $this->assertEquals('License', $tag->getLicenseName());
 }
Beispiel #3
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @throws Exception\\Invalid description');
     $reflectionTag = $docreflection->getTag('throws');
     /** @var ThrowsTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\ThrowsTag', $tag);
     $this->assertEquals('description', $tag->getDescription());
     $this->assertEquals('Exception\\Invalid', $tag->getTypesAsString());
 }
Beispiel #4
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @author Mister Miller <*****@*****.**>');
     $reflectionTag = $docreflection->getTag('author');
     /** @var AuthorTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\AuthorTag', $tag);
     $this->assertEquals('Mister Miller', $tag->getAuthorName());
     $this->assertEquals('*****@*****.**', $tag->getAuthorEmail());
 }
Beispiel #5
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @return int The return');
     $reflectionTag = $docreflection->getTag('return');
     /** @var ReturnTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\ReturnTag', $tag);
     $this->assertEquals('The return', $tag->getDescription());
     $this->assertEquals('int', $tag->getTypesAsString());
 }
Beispiel #6
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @property int $foo description');
     $reflectionTag = $docreflection->getTag('property');
     /** @var PropertyTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\PropertyTag', $tag);
     $this->assertEquals('foo', $tag->getPropertyName());
     $this->assertEquals('description', $tag->getDescription());
     $this->assertEquals('int', $tag->getTypesAsString());
 }
Beispiel #7
0
 public function testCreatingTagFromReflection()
 {
     $docreflection = new DocBlockReflection('/** @method static int method() method(int $a)');
     $reflectionTag = $docreflection->getTag('method');
     /** @var MethodTag $tag */
     $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
     $this->assertInstanceOf('Zend\\Code\\Generator\\DocBlock\\Tag\\MethodTag', $tag);
     $this->assertEquals(true, $tag->isStatic());
     $this->assertEquals('int', $tag->getTypesAsString());
     $this->assertEquals('method', $tag->getMethodName());
     $this->assertEquals('method(int $a)', $tag->getDescription());
 }
Beispiel #8
0
 /**
  * @param  ReflectionTagInterface $reflectionTag
  * @return Tag
  * @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
  */
 public static function fromReflection(ReflectionTagInterface $reflectionTag)
 {
     $tagManager = new TagManager();
     $tagManager->initializeDefaultTags();
     return $tagManager->createTagFromReflection($reflectionTag);
 }