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\Util;
14 use Psy\Reflection\ReflectionConstant;
17 class MirrorTest extends \PHPUnit_Framework_TestCase
21 private static $baz = 3;
23 public function aPublicMethod()
28 public function testMirror()
30 $refl = Mirror::get('sort');
31 $this->assertTrue($refl instanceof \ReflectionFunction);
33 $refl = Mirror::get('Psy\Test\Util\MirrorTest');
34 $this->assertTrue($refl instanceof \ReflectionClass);
36 $refl = Mirror::get($this);
37 $this->assertTrue($refl instanceof \ReflectionObject);
39 $refl = Mirror::get($this, 'FOO');
40 $this->assertTrue($refl instanceof ReflectionConstant);
42 $refl = Mirror::get($this, 'bar');
43 $this->assertTrue($refl instanceof \ReflectionProperty);
45 $refl = Mirror::get($this, 'baz');
46 $this->assertTrue($refl instanceof \ReflectionProperty);
48 $refl = Mirror::get($this, 'aPublicMethod');
49 $this->assertTrue($refl instanceof \ReflectionMethod);
51 $refl = Mirror::get($this, 'baz', Mirror::STATIC_PROPERTY);
52 $this->assertTrue($refl instanceof \ReflectionProperty);
56 * @expectedException \RuntimeException
58 public function testMirrorThrowsExceptions()
60 Mirror::get($this, 'notAMethod');
64 * @expectedException \InvalidArgumentException
65 * @dataProvider invalidArguments
67 public function testMirrorThrowsInvalidArgumentExceptions($value)
72 public function invalidArguments()
75 array('not_a_function_or_class'),