4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Test\Formatter;
14 use Psy\Formatter\SignatureFormatter;
15 use Psy\Reflection\ReflectionConstant;
17 class SignatureFormatterTest extends \PHPUnit\Framework\TestCase
19 const FOO = 'foo value';
20 private static $bar = 'bar value';
22 private function someFakeMethod(array $one, $two = 'TWO', \Reflector $three = null)
27 * @dataProvider signatureReflectors
29 public function testFormat($reflector, $expected)
31 $this->assertEquals($expected, strip_tags(SignatureFormatter::format($reflector)));
34 public function signatureReflectors()
38 new \ReflectionFunction('implode'),
39 defined('HHVM_VERSION') ? 'function implode($arg1, $arg2 = null)' : 'function implode($glue, $pieces)',
42 new ReflectionConstant($this, 'FOO'),
43 'const FOO = "foo value"',
46 new \ReflectionMethod($this, 'someFakeMethod'),
47 'private function someFakeMethod(array $one, $two = \'TWO\', Reflector $three = null)',
50 new \ReflectionProperty($this, 'bar'),
51 'private static $bar',
54 new \ReflectionClass('Psy\CodeCleaner\CodeCleanerPass'),
55 'abstract class Psy\CodeCleaner\CodeCleanerPass '
56 . 'extends PhpParser\NodeVisitorAbstract '
57 . 'implements PhpParser\NodeVisitor',
63 * @expectedException \InvalidArgumentException
65 public function testSignatureFormatterThrowsUnknownReflectorExpeption()
67 $refl = $this->getMockBuilder('Reflector')->getMock();
68 SignatureFormatter::format($refl);