4 * This file is part of Psy Shell.
6 * (c) 2012-2018 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;
16 class MirrorTest extends \PHPUnit\Framework\TestCase
20 private static $baz = 3;
22 public function aPublicMethod()
27 public function testMirror()
29 $refl = Mirror::get('sort');
30 $this->assertInstanceOf('ReflectionFunction', $refl);
32 $refl = Mirror::get('Psy\Test\Util\MirrorTest');
33 $this->assertInstanceOf('ReflectionClass', $refl);
35 $refl = Mirror::get($this);
36 $this->assertInstanceOf('ReflectionObject', $refl);
38 $refl = Mirror::get($this, 'FOO');
39 $this->assertInstanceOf('Psy\Reflection\ReflectionConstant', $refl);
41 $refl = Mirror::get($this, 'bar');
42 $this->assertInstanceOf('ReflectionProperty', $refl);
44 $refl = Mirror::get($this, 'baz');
45 $this->assertInstanceOf('ReflectionProperty', $refl);
47 $refl = Mirror::get($this, 'aPublicMethod');
48 $this->assertInstanceOf('ReflectionMethod', $refl);
50 $refl = Mirror::get($this, 'baz', Mirror::STATIC_PROPERTY);
51 $this->assertInstanceOf('ReflectionProperty', $refl);
55 * @expectedException \RuntimeException
57 public function testMirrorThrowsExceptions()
59 Mirror::get($this, 'notAMethod');
63 * @expectedException \InvalidArgumentException
64 * @dataProvider invalidArguments
66 public function testMirrorThrowsInvalidArgumentExceptions($value)
71 public function invalidArguments()
74 ['not_a_function_or_class'],