X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FCodeCleaner%2FValidConstantPassTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FCodeCleaner%2FValidConstantPassTest.php;h=a6c52e0419d8f5c8f52e86b98191a294c82a0f55;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=0000000000000000000000000000000000000000;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php new file mode 100644 index 000000000..a6c52e041 --- /dev/null +++ b/vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php @@ -0,0 +1,65 @@ +setPass(new ValidConstantPass()); + } + + /** + * @dataProvider getInvalidReferences + * @expectedException \Psy\Exception\FatalErrorException + */ + public function testProcessInvalidConstantReferences($code) + { + $this->parseAndTraverse($code); + } + + public function getInvalidReferences() + { + return [ + ['Foo\BAR'], + + // class constant fetch + ['Psy\Test\CodeCleaner\ValidConstantPassTest::FOO'], + ['DateTime::BACON'], + ]; + } + + /** + * @dataProvider getValidReferences + */ + public function testProcessValidConstantReferences($code) + { + $this->parseAndTraverse($code); + $this->assertTrue(true); + } + + public function getValidReferences() + { + return [ + ['PHP_EOL'], + + // class constant fetch + ['NotAClass::FOO'], + ['DateTime::ATOM'], + ['$a = new DateTime; $a::ATOM'], + ['DateTime::class'], + ['$a = new DateTime; $a::class'], + ]; + } +}