Mercurial > hg > cmmr2012-drupal-site
comparison vendor/psy/psysh/test/Formatter/DocblockFormatterTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of Psy Shell. | |
5 * | |
6 * (c) 2012-2018 Justin Hileman | |
7 * | |
8 * For the full copyright and license information, please view the LICENSE | |
9 * file that was distributed with this source code. | |
10 */ | |
11 | |
12 namespace Psy\Test\Formatter; | |
13 | |
14 use Psy\Formatter\DocblockFormatter; | |
15 | |
16 class DocblockFormatterTest extends \PHPUnit\Framework\TestCase | |
17 { | |
18 /** | |
19 * This is a docblock! | |
20 * | |
21 * @author Justin Hileman <justin@justinhileman.info> | |
22 * | |
23 * @throws InvalidArgumentException if $foo is empty | |
24 * | |
25 * @param mixed $foo It's a foo thing | |
26 * @param int $bar This is definitely bar | |
27 * | |
28 * @return string A string of no consequence | |
29 */ | |
30 private function methodWithDocblock($foo, $bar = 1) | |
31 { | |
32 if (empty($foo)) { | |
33 throw new \InvalidArgumentException(); | |
34 } | |
35 | |
36 return 'method called'; | |
37 } | |
38 | |
39 public function testFormat() | |
40 { | |
41 $expected = <<<EOS | |
42 <comment>Description:</comment> | |
43 This is a docblock! | |
44 | |
45 <comment>Throws:</comment> | |
46 <info>InvalidArgumentException </info> if \$foo is empty | |
47 | |
48 <comment>Param:</comment> | |
49 <info>mixed </info> <strong>\$foo </strong> It's a foo thing | |
50 <info>int </info> <strong>\$bar </strong> This is definitely bar | |
51 | |
52 <comment>Return:</comment> | |
53 <info>string </info> A string of no consequence | |
54 | |
55 <comment>Author:</comment> Justin Hileman \<justin@justinhileman.info> | |
56 EOS; | |
57 | |
58 $this->assertSame( | |
59 $expected, | |
60 DocblockFormatter::format(new \ReflectionMethod($this, 'methodWithDocblock')) | |
61 ); | |
62 } | |
63 } |