X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FCodeCleaner%2FUseStatementPassTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FCodeCleaner%2FUseStatementPassTest.php;h=9c525efefdf951129bc27eb49db72b59b449707e;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php new file mode 100644 index 000000000..9c525efef --- /dev/null +++ b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php @@ -0,0 +1,52 @@ +setPass(new UseStatementPass()); + } + + /** + * @dataProvider useStatements + */ + public function testProcess($from, $to) + { + $this->assertProcessesAs($from, $to); + } + + public function useStatements() + { + return array( + array( + "use StdClass as NotSoStd;\n\$std = new NotSoStd();", + '$std = new \\StdClass();', + ), + array( + "namespace Foo;\n\nuse StdClass as S;\n\$std = new S();", + "namespace Foo;\n\n\$std = new \\StdClass();", + ), + array( + "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();", + "namespace Foo;\n\n\$std = new \\StdClass();", + ), + array( + "use Foo\\Bar as fb;\n\$baz = new fb\\Baz();", + '$baz = new \\Foo\\Bar\\Baz();', + ), + ); + } +}