You are here

ThrowsTagTest.php in Zircon Profile 8

File

vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/Tag/ThrowsTagTest.php
View source
<?php

/**
 * phpDocumentor Throws tag test.
 * 
 * PHP version 5.3
 *
 * @author    Mike van Riel <mike.vanriel@naenius.com>
 * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      http://phpdoc.org
 */
namespace phpDocumentor\Reflection\DocBlock\Tag;


/**
 * Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag
 *
 * @author    Mike van Riel <mike.vanriel@naenius.com>
 * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      http://phpdoc.org
 */
class ThrowsTagTest extends \PHPUnit_Framework_TestCase {

  /**
   * Test that the \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag can
   * understand the @throws DocBlock.
   *
   * @param string $type
   * @param string $content
   * @param string $extractedType
   * @param string $extractedTypes
   * @param string $extractedDescription
   *
   * @covers \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
   * @dataProvider provideDataForConstructor
   *
   * @return void
   */
  public function testConstructorParsesInputsIntoCorrectFields($type, $content, $extractedType, $extractedTypes, $extractedDescription) {
    $tag = new ThrowsTag($type, $content);
    $this
      ->assertEquals($type, $tag
      ->getName());
    $this
      ->assertEquals($extractedType, $tag
      ->getType());
    $this
      ->assertEquals($extractedTypes, $tag
      ->getTypes());
    $this
      ->assertEquals($extractedDescription, $tag
      ->getDescription());
  }

  /**
   * Data provider for testConstructorParsesInputsIntoCorrectFields()
   *
   * @return array
   */
  public function provideDataForConstructor() {
    return array(
      array(
        'throws',
        '',
        '',
        array(),
        '',
      ),
      array(
        'throws',
        'int',
        'int',
        array(
          'int',
        ),
        '',
      ),
      array(
        'throws',
        'int Number of Bobs',
        'int',
        array(
          'int',
        ),
        'Number of Bobs',
      ),
      array(
        'throws',
        'int|double Number of Bobs',
        'int|double',
        array(
          'int',
          'double',
        ),
        'Number of Bobs',
      ),
      array(
        'throws',
        "int Number of \n Bobs",
        'int',
        array(
          'int',
        ),
        "Number of \n Bobs",
      ),
      array(
        'throws',
        " int Number of Bobs",
        'int',
        array(
          'int',
        ),
        "Number of Bobs",
      ),
      array(
        'throws',
        "int\nNumber of Bobs",
        'int',
        array(
          'int',
        ),
        "Number of Bobs",
      ),
    );
  }

}

Classes

Namesort descending Description
ThrowsTagTest Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag