Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Added test for ThrowsTag
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Sep 3, 2013
1 parent 3bdf00b commit 32d6ac8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/ZendTest/Code/Reflection/DocBlock/Tag/ThrowsTagTest.php
@@ -0,0 +1,58 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\Code\Reflection\DocBlock\Tag;

use Zend\Code\Reflection\DocBlock\Tag\ThrowsTag;

/**
* @group Zend_Reflection
* @group Zend_Reflection_DocBlock
*/
class ThrowsTagTest extends \PHPUnit_Framework_TestCase
{
public function testAllCharactersFromTypenameAreSupported()
{
$tag = new ThrowsTag();
$tag->initialize('\\Logic_2_Exception');
$this->assertEquals(array('\\Logic_2_Exception'), $tag->getTypes());
}

public function testSingleTypeWithDescription()
{
$tag = new ThrowsTag();
$tag->initialize('LogicException The Exception');
$this->assertEquals(array('LogicException'), $tag->getTypes());
$this->assertEquals('The Exception', $tag->getDescription());
}

public function testSingleTypeWithoutDescription()
{
$tag = new ThrowsTag();
$tag->initialize('LogicException');
$this->assertEquals(array('LogicException'), $tag->getTypes());
$this->assertNull($tag->getDescription());
}

public function testMultipleTypesWithoutDescription()
{
$tag = new ThrowsTag();
$tag->initialize('LogicException|RuntimeException');
$this->assertEquals(array('LogicException', 'RuntimeException'), $tag->getTypes());
$this->assertNull($tag->getDescription());
}

public function testMultipleTypesWithDescription()
{
$tag = new ThrowsTag();
$tag->initialize('LogicException|RuntimeException The Exception');
$this->assertEquals(array('LogicException', 'RuntimeException'), $tag->getTypes());
$this->assertEquals('The Exception', $tag->getDescription());
}
}

0 comments on commit 32d6ac8

Please sign in to comment.