annotate vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php @ 8:50b0d041100e
Further files for download
author |
Chris Cannam |
date |
Mon, 05 Feb 2018 10:56:40 +0000 |
parents |
4c8ae668cc8c |
children |
|
rev |
line source |
Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of Psy Shell.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) 2012-2017 Justin Hileman
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Psy\Test\CodeCleaner;
|
Chris@0
|
13
|
Chris@0
|
14 use Psy\CodeCleaner\UseStatementPass;
|
Chris@0
|
15
|
Chris@0
|
16 class UseStatementPassTest extends CodeCleanerTestCase
|
Chris@0
|
17 {
|
Chris@0
|
18 public function setUp()
|
Chris@0
|
19 {
|
Chris@0
|
20 $this->setPass(new UseStatementPass());
|
Chris@0
|
21 }
|
Chris@0
|
22
|
Chris@0
|
23 /**
|
Chris@0
|
24 * @dataProvider useStatements
|
Chris@0
|
25 */
|
Chris@0
|
26 public function testProcess($from, $to)
|
Chris@0
|
27 {
|
Chris@0
|
28 $this->assertProcessesAs($from, $to);
|
Chris@0
|
29 }
|
Chris@0
|
30
|
Chris@0
|
31 public function useStatements()
|
Chris@0
|
32 {
|
Chris@0
|
33 return array(
|
Chris@0
|
34 array(
|
Chris@0
|
35 "use StdClass as NotSoStd;\n\$std = new NotSoStd();",
|
Chris@0
|
36 '$std = new \\StdClass();',
|
Chris@0
|
37 ),
|
Chris@0
|
38 array(
|
Chris@0
|
39 "namespace Foo;\n\nuse StdClass as S;\n\$std = new S();",
|
Chris@0
|
40 "namespace Foo;\n\n\$std = new \\StdClass();",
|
Chris@0
|
41 ),
|
Chris@0
|
42 array(
|
Chris@0
|
43 "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();",
|
Chris@0
|
44 "namespace Foo;\n\n\$std = new \\StdClass();",
|
Chris@0
|
45 ),
|
Chris@0
|
46 array(
|
Chris@0
|
47 "use Foo\\Bar as fb;\n\$baz = new fb\\Baz();",
|
Chris@0
|
48 '$baz = new \\Foo\\Bar\\Baz();',
|
Chris@0
|
49 ),
|
Chris@0
|
50 );
|
Chris@0
|
51 }
|
Chris@0
|
52 }
|