X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FUtil%2FMirrorTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FUtil%2FMirrorTest.php;h=6caecb551ceb68be4eb888db838c38d429629a47;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/psy/psysh/test/Util/MirrorTest.php b/vendor/psy/psysh/test/Util/MirrorTest.php new file mode 100644 index 000000000..6caecb551 --- /dev/null +++ b/vendor/psy/psysh/test/Util/MirrorTest.php @@ -0,0 +1,79 @@ +assertInstanceOf('ReflectionFunction', $refl); + + $refl = Mirror::get('Psy\Test\Util\MirrorTest'); + $this->assertInstanceOf('ReflectionClass', $refl); + + $refl = Mirror::get($this); + $this->assertInstanceOf('ReflectionObject', $refl); + + $refl = Mirror::get($this, 'FOO'); + $this->assertInstanceOf('Psy\Reflection\ReflectionConstant', $refl); + + $refl = Mirror::get($this, 'bar'); + $this->assertInstanceOf('ReflectionProperty', $refl); + + $refl = Mirror::get($this, 'baz'); + $this->assertInstanceOf('ReflectionProperty', $refl); + + $refl = Mirror::get($this, 'aPublicMethod'); + $this->assertInstanceOf('ReflectionMethod', $refl); + + $refl = Mirror::get($this, 'baz', Mirror::STATIC_PROPERTY); + $this->assertInstanceOf('ReflectionProperty', $refl); + } + + /** + * @expectedException \RuntimeException + */ + public function testMirrorThrowsExceptions() + { + Mirror::get($this, 'notAMethod'); + } + + /** + * @expectedException \InvalidArgumentException + * @dataProvider invalidArguments + */ + public function testMirrorThrowsInvalidArgumentExceptions($value) + { + Mirror::get($value); + } + + public function invalidArguments() + { + return [ + ['not_a_function_or_class'], + [[]], + [1], + ]; + } +}