Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.

Commit 81bc374

Browse files
committed
[OptimizeUse] add failing feature for #32
1 parent 1fd33a4 commit 81bc374

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

features/optimize_use.feature

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,38 @@ Feature: Optimize use
4747
4848
return $service;
4949
"""
50+
Scenario: Organize use for file without namespace and other uses
51+
Given a PHP File named "src/Foo.php" with:
52+
"""
53+
<?php
54+
55+
class Foo
56+
{
57+
public function operation()
58+
{
59+
return new \Bar\Qux\Adapter();
60+
}
61+
}
62+
"""
63+
When I use refactoring "optimize-use" with:
64+
| arg | value |
65+
| file | src/Foo.php |
66+
Then the PHP File "src/Foo.php" should be refactored:
67+
"""
68+
--- a/vfs://project/src/Foo.php
69+
+++ b/vfs://project/src/Foo.php
70+
@@ -1,4 +1,6 @@
71+
<?php
5072
73+
+use Bar\Qux\Adapter;
74+
+
75+
class Foo
76+
{
77+
@@ -5,5 +5,5 @@
78+
public function operation()
79+
{
80+
- return new \Bar\Qux\Adapter();
81+
+ return new Adapter();
82+
}
83+
}
84+
"""

0 commit comments

Comments
 (0)