annotate vendor/psy/psysh/test/CodeCleaner/UseStatementPassTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 5fb285c0d0e3
children c2387f117808
rev   line source
Chris@13 1 <?php
Chris@13 2
Chris@13 3 /*
Chris@13 4 * This file is part of Psy Shell.
Chris@13 5 *
Chris@13 6 * (c) 2012-2018 Justin Hileman
Chris@13 7 *
Chris@13 8 * For the full copyright and license information, please view the LICENSE
Chris@13 9 * file that was distributed with this source code.
Chris@13 10 */
Chris@13 11
Chris@13 12 namespace Psy\Test\CodeCleaner;
Chris@13 13
Chris@13 14 use Psy\CodeCleaner\UseStatementPass;
Chris@13 15
Chris@13 16 class UseStatementPassTest extends CodeCleanerTestCase
Chris@13 17 {
Chris@13 18 public function setUp()
Chris@13 19 {
Chris@13 20 $this->setPass(new UseStatementPass());
Chris@13 21 }
Chris@13 22
Chris@13 23 /**
Chris@13 24 * @dataProvider useStatements
Chris@13 25 */
Chris@13 26 public function testProcess($from, $to)
Chris@13 27 {
Chris@13 28 $this->assertProcessesAs($from, $to);
Chris@13 29 }
Chris@13 30
Chris@13 31 public function useStatements()
Chris@13 32 {
Chris@13 33 return [
Chris@13 34 [
Chris@13 35 "use StdClass as NotSoStd;\n\$std = new NotSoStd();",
Chris@13 36 '$std = new \\StdClass();',
Chris@13 37 ],
Chris@13 38 [
Chris@13 39 "namespace Foo;\n\nuse StdClass as S;\n\$std = new S();",
Chris@13 40 "namespace Foo;\n\n\$std = new \\StdClass();",
Chris@13 41 ],
Chris@13 42 [
Chris@13 43 "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();",
Chris@13 44 "namespace Foo;\n\n\$std = new \\StdClass();",
Chris@13 45 ],
Chris@13 46 [
Chris@13 47 "use Foo\\Bar as fb;\n\$baz = new fb\\Baz();",
Chris@13 48 '$baz = new \\Foo\\Bar\\Baz();',
Chris@13 49 ],
Chris@13 50 [
Chris@13 51 "use Foo\\Bar;\n\$baz = new Bar\\Baz();",
Chris@13 52 '$baz = new \\Foo\\Bar\\Baz();',
Chris@13 53 ],
Chris@13 54 [
Chris@13 55 "namespace Foo;\nuse Bar;\n\$baz = new Bar\\Baz();",
Chris@13 56 "namespace Foo;\n\n\$baz = new \\Bar\\Baz();",
Chris@13 57 ],
Chris@13 58 ];
Chris@13 59 }
Chris@13 60 }