2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace Icanhazstring \Composer \Test \Unused \Integration \Parser ;
5
+ namespace Icanhazstring \Composer \Test \Unused \Integration \Parser \ PHP ;
6
6
7
7
use Exception ;
8
8
use Icanhazstring \Composer \Unused \Error \ErrorHandlerInterface ;
9
- use Icanhazstring \Composer \Unused \Parser \NodeVisitor ;
10
- use Icanhazstring \Composer \Unused \Parser \Strategy \ClassConstStrategy ;
11
- use Icanhazstring \Composer \Unused \Parser \Strategy \NewParseStrategy ;
12
- use Icanhazstring \Composer \Unused \Parser \Strategy \ParseStrategyInterface ;
13
- use Icanhazstring \Composer \Unused \Parser \Strategy \PhpExtensionStrategy ;
14
- use Icanhazstring \Composer \Unused \Parser \Strategy \StaticParseStrategy ;
15
- use Icanhazstring \Composer \Unused \Parser \Strategy \UseParseStrategy ;
9
+ use Icanhazstring \Composer \Unused \Parser \PHP \ NodeVisitor ;
10
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \ClassConstStrategy ;
11
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \NewParseStrategy ;
12
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \ParseStrategyInterface ;
13
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \PhpExtensionStrategy ;
14
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \StaticParseStrategy ;
15
+ use Icanhazstring \Composer \Unused \Parser \PHP \ Strategy \UseParseStrategy ;
16
16
use PhpParser \Node ;
17
17
use PhpParser \NodeTraverser ;
18
18
use PhpParser \ParserFactory ;
@@ -34,45 +34,45 @@ public function itShouldParseUsagesDataProvider(): array
34
34
return [
35
35
'StaticParseStrategyShouldReturnEmptyUsageOnVariableCall ' => [
36
36
'expectedUsedNamespaces ' => [],
37
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/StaticVariableCall.php ' ,
37
+ 'inputFile ' => ASSET_DIR . '/TestFiles/StaticVariableCall.php ' ,
38
38
'strategy ' => new StaticParseStrategy ()
39
39
],
40
40
'StaticParseStrategyShouldReturnEmptyUsageOnNonFQCall ' => [
41
41
'expectedUsedNamespaces ' => [],
42
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/StaticNonFullyQualifiedCall.php ' ,
42
+ 'inputFile ' => ASSET_DIR . '/TestFiles/StaticNonFullyQualifiedCall.php ' ,
43
43
'strategy ' => new StaticParseStrategy ()
44
44
],
45
45
'StaticParseStrategyShouldReturnCorrectNamespaceOnFQCall ' => [
46
46
'expectedUsedNamespaces ' => [
47
47
'StaticFullyQualifiedCall '
48
48
],
49
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/StaticFullyQualifiedCall.php ' ,
49
+ 'inputFile ' => ASSET_DIR . '/TestFiles/StaticFullyQualifiedCall.php ' ,
50
50
'strategy ' => new StaticParseStrategy ()
51
51
],
52
52
'NewParseStrategyShouldReturnEmptyUsageOnDynamicClassnameCall ' => [
53
53
'expectedUsedNamespaces ' => [],
54
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/NewInstantiateDynamicClass.php ' ,
54
+ 'inputFile ' => ASSET_DIR . '/TestFiles/NewInstantiateDynamicClass.php ' ,
55
55
'strategy ' => new NewParseStrategy ()
56
56
],
57
57
'NewParseStrategyShouldReturnEmptyUsageOnNonFQCall ' => [
58
58
'expectedUsedNamespaces ' => [],
59
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/NewInstantiateNonFullyQualifiedCall.php ' ,
59
+ 'inputFile ' => ASSET_DIR . '/TestFiles/NewInstantiateNonFullyQualifiedCall.php ' ,
60
60
'strategy ' => new NewParseStrategy ()
61
61
],
62
62
'NewParseStrategyShouldReturnCorrectNamespaceOnFQCall ' => [
63
63
'expectedUsedNamespaces ' => [
64
64
'NewInstantiateFullyQualifiedCall '
65
65
],
66
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/NewInstantiateFullyQualifiedCall.php ' ,
66
+ 'inputFile ' => ASSET_DIR . '/TestFiles/NewInstantiateFullyQualifiedCall.php ' ,
67
67
'strategy ' => new NewParseStrategy ()
68
68
],
69
69
'UseParseStrategyShouldReturnSingleLineImportedNamespaces ' => [
70
70
'expectedUsedNamespaces ' => [
71
71
'Icanhazstring\Composer ' ,
72
- 'Icanhazstring\Composer\Unused\Parser ' ,
72
+ 'Icanhazstring\Composer\Unused\Parser\PHP ' ,
73
73
'Icanhazstring\Composer\Unused\Command '
74
74
],
75
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/UseSingleLineNoGroup.php ' ,
75
+ 'inputFile ' => ASSET_DIR . '/TestFiles/UseSingleLineNoGroup.php ' ,
76
76
'strategy ' => new UseParseStrategy ()
77
77
],
78
78
'UseParseStrategyShouldReturnMultiLineImportedNamespaces ' => [
@@ -81,79 +81,79 @@ public function itShouldParseUsagesDataProvider(): array
81
81
StaticParseStrategy::class,
82
82
NewParseStrategy::class
83
83
],
84
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/UseMultiLineGroup.php ' ,
84
+ 'inputFile ' => ASSET_DIR . '/TestFiles/UseMultiLineGroup.php ' ,
85
85
'strategy ' => new UseParseStrategy ()
86
86
],
87
87
'ClassConstStrategyShouldReturnCorrectNamespace ' => [
88
88
'expectedUsedNamespaces ' => [
89
89
UseParseStrategy::class,
90
90
StaticParseStrategy::class
91
91
],
92
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/ClassConst.php ' ,
92
+ 'inputFile ' => ASSET_DIR . '/TestFiles/ClassConst.php ' ,
93
93
'strategy ' => new ClassConstStrategy ()
94
94
],
95
95
'NewParseStrategyShouldReturnQualifiedNamespace ' => [
96
96
'expectedUsedNamespaces ' => [
97
97
'TestFile\NewInstantiateQualifiedClass '
98
98
],
99
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/NewInstantiateQualifiedClass.php ' ,
99
+ 'inputFile ' => ASSET_DIR . '/TestFiles/NewInstantiateQualifiedClass.php ' ,
100
100
'strategy ' => new NewParseStrategy ()
101
101
],
102
102
'StaticParseStrategyShouldReturnQualifiedNamespace ' => [
103
103
'expectedUsedNamespaces ' => [
104
104
'TestFile\StaticQualifiedCall '
105
105
],
106
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/StaticQualifiedCall.php ' ,
106
+ 'inputFile ' => ASSET_DIR . '/TestFiles/StaticQualifiedCall.php ' ,
107
107
'strategy ' => new StaticParseStrategy ()
108
108
],
109
109
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---1 ' => [
110
110
'expectedUsedNamespaces ' => [],
111
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithCustomInterfaceName.php ' ,
111
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithCustomInterfaceName.php ' ,
112
112
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
113
113
],
114
114
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---2 ' => [
115
115
'expectedUsedNamespaces ' => [],
116
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithCustomInterface.php ' ,
116
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithCustomInterface.php ' ,
117
117
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
118
118
],
119
119
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---3 ' => [
120
120
'expectedUsedNamespaces ' => ['ext-json ' ],
121
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithExtensionInterface.php ' ,
121
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithExtensionInterface.php ' ,
122
122
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
123
123
],
124
124
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---4 ' => [
125
125
'expectedUsedNamespaces ' => ['ext-json ' ],
126
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithExtensionInterfaceInUse.php ' ,
126
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithExtensionInterfaceInUse.php ' ,
127
127
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
128
128
],
129
129
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---5 ' => [
130
130
'expectedUsedNamespaces ' => [],
131
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithCustomConstant.php ' ,
131
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithCustomConstant.php ' ,
132
132
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
133
133
],
134
134
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---6 ' => [
135
135
'expectedUsedNamespaces ' => ['ext-json ' ],
136
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithJsonConstant.php ' ,
136
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithJsonConstant.php ' ,
137
137
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
138
138
],
139
139
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---7 ' => [
140
140
'expectedUsedNamespaces ' => ['ext-json ' ],
141
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithExtensionFunction.php ' ,
141
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithExtensionFunction.php ' ,
142
142
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
143
143
],
144
144
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---8 ' => [
145
145
'expectedUsedNamespaces ' => [],
146
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithCustomFunction.php ' ,
146
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithCustomFunction.php ' ,
147
147
'strategy ' => new PhpExtensionStrategy (['json ' ], new NullLogger ())
148
148
],
149
149
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---9 ' => [
150
150
'expectedUsedNamespaces ' => ['ext-zend-opcache ' ],
151
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithZendOpcache.php ' ,
151
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithZendOpcache.php ' ,
152
152
'strategy ' => new PhpExtensionStrategy (['Zend Opcache ' ], new NullLogger ())
153
153
],
154
154
'PhpExtensionParseStrategyShouldReturnQualifiedNamespace---10 ' => [
155
155
'expectedUsedNamespaces ' => ['php ' ],
156
- 'inputFile ' => __DIR__ . '/../../assets /TestFiles/PhpExtensionStrategy/ClassWithCore.php ' ,
156
+ 'inputFile ' => ASSET_DIR . '/TestFiles/PhpExtensionStrategy/ClassWithCore.php ' ,
157
157
'strategy ' => new PhpExtensionStrategy (['Core ' ], new NullLogger ())
158
158
],
159
159
];
@@ -192,7 +192,7 @@ public function itShouldRaiseExceptionHandledByErrorHandler(): void
192
192
{
193
193
$ parser = (new ParserFactory ())->create (ParserFactory::ONLY_PHP7 );
194
194
/** @var string $inputFile */
195
- $ inputFile = __DIR__ . '/../../assets /TestFiles/UseSingleLineNoGroup.php ' ;
195
+ $ inputFile = ASSET_DIR . '/TestFiles/UseSingleLineNoGroup.php ' ;
196
196
/** @var string $contents */
197
197
$ contents = file_get_contents ($ inputFile );
198
198
/** @var Node[] $nodes */
0 commit comments