|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of phpDocumentor. |
| 4 | + * |
| 5 | + * For the full copyright and license information, please view the LICENSE |
| 6 | + * file that was distributed with this source code. |
| 7 | + * |
| 8 | + * @author Jan Schneider <[email protected]> |
| 9 | + * @copyright 2017 Mike van Riel<[email protected]> |
| 10 | + * @license http://www.opensource.org/licenses/mit-license.php MIT |
| 11 | + * @link http://phpdoc.org |
| 12 | + */ |
| 13 | + |
| 14 | +namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; |
| 15 | + |
| 16 | +use phpDocumentor\Reflection\DocBlock\Description; |
| 17 | +use phpDocumentor\Reflection\DocBlock\Tags\Link; |
| 18 | +use phpDocumentor\Reflection\DocBlock\Tags\Param; |
| 19 | +use phpDocumentor\Reflection\DocBlock\Tags\Version; |
| 20 | +use phpDocumentor\Reflection\Types\String_; |
| 21 | + |
| 22 | +/** |
| 23 | + * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\Formatter\AlignFormatter |
| 24 | + */ |
| 25 | +class PassthroughFormatterTest extends \PHPUnit_Framework_TestCase |
| 26 | +{ |
| 27 | + /** |
| 28 | + * @covers ::format |
| 29 | + * @uses \phpDocumentor\Reflection\DocBlock\Description |
| 30 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag |
| 31 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link |
| 32 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param |
| 33 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version |
| 34 | + * @uses \phpDocumentor\Reflection\Types\String_ |
| 35 | + */ |
| 36 | + public function testFormatterCallsToStringAndReturnsAStandardRepresentation() |
| 37 | + { |
| 38 | + $tags = array( |
| 39 | + new Param('foobar', new String_()), |
| 40 | + new Version('1.2.0'), |
| 41 | + new Link('http://www.example.com', new Description('Examples')) |
| 42 | + ); |
| 43 | + $fixture = new AlignFormatter($tags); |
| 44 | + |
| 45 | + $expected = array( |
| 46 | + '@param string $foobar', |
| 47 | + '@version 1.2.0', |
| 48 | + '@link http://www.example.com Examples' |
| 49 | + ); |
| 50 | + |
| 51 | + foreach ($tags as $key => $tag) { |
| 52 | + $this->assertSame( |
| 53 | + $expected[$key], |
| 54 | + $fixture->format($tag) |
| 55 | + ); |
| 56 | + } |
| 57 | + } |
| 58 | +} |
0 commit comments