Code Duplication    Length = 12-12 lines in 11 locations

test/ComposerRequireCheckerTest/NodeVisitor/UsedSymbolCollectorTest.php 11 locations

@@ 78-89 (lines=12) @@
75
        $this->assertContains('Baz', $symbols);
76
    }
77
78
    public function testStaticCall()
79
    {
80
        $class = new Name('Foo');
81
        $node = new StaticCall($class, 'foo');
82
        $node->class = $class;
83
84
        $this->visitor->enterNode($node);
85
86
        $symbols = $this->visitor->getCollectedSymbols();
87
        $this->assertCount(1, $symbols);
88
        $this->assertContains('Foo', $symbols);
89
    }
90
91
    public function testStaticPropertyFetch()
92
    {
@@ 91-102 (lines=12) @@
88
        $this->assertContains('Foo', $symbols);
89
    }
90
91
    public function testStaticPropertyFetch()
92
    {
93
        $class = new Name('Foo');
94
        $node = new StaticPropertyFetch($class, 'foo');
95
        $node->class = $class;
96
97
        $this->visitor->enterNode($node);
98
99
        $symbols = $this->visitor->getCollectedSymbols();
100
        $this->assertCount(1, $symbols);
101
        $this->assertContains('Foo', $symbols);
102
    }
103
104
    public function testClassConstantFetch()
105
    {
@@ 104-115 (lines=12) @@
101
        $this->assertContains('Foo', $symbols);
102
    }
103
104
    public function testClassConstantFetch()
105
    {
106
        $class = new Name('Foo');
107
        $node = new ClassConstFetch($class, 'FOO');
108
        $node->class = $class;
109
110
        $this->visitor->enterNode($node);
111
112
        $symbols = $this->visitor->getCollectedSymbols();
113
        $this->assertCount(1, $symbols);
114
        $this->assertContains('Foo', $symbols);
115
    }
116
117
    public function testNew()
118
    {
@@ 117-128 (lines=12) @@
114
        $this->assertContains('Foo', $symbols);
115
    }
116
117
    public function testNew()
118
    {
119
        $class = new Name('Foo');
120
        $node = new New_($class);
121
        $node->class = $class;
122
123
        $this->visitor->enterNode($node);
124
125
        $symbols = $this->visitor->getCollectedSymbols();
126
        $this->assertCount(1, $symbols);
127
        $this->assertContains('Foo', $symbols);
128
    }
129
130
    public function testInstanceof()
131
    {
@@ 130-141 (lines=12) @@
127
        $this->assertContains('Foo', $symbols);
128
    }
129
130
    public function testInstanceof()
131
    {
132
        $class = new Name('Foo');
133
        $node = new Instanceof_(new Variable('foo'), $class);
134
        $node->class = $class;
135
136
        $this->visitor->enterNode($node);
137
138
        $symbols = $this->visitor->getCollectedSymbols();
139
        $this->assertCount(1, $symbols);
140
        $this->assertContains('Foo', $symbols);
141
    }
142
143
    public function testCatch()
144
    {
@@ 155-166 (lines=12) @@
152
        $this->assertContains('Foo', $symbols);
153
    }
154
155
    public function testFunctionCallUsage()
156
    {
157
        $functionName = new Name('foo');
158
        $node = new FuncCall($functionName);
159
        $node->name = $functionName;
160
161
        $this->visitor->enterNode($node);
162
163
        $symbols = $this->visitor->getCollectedSymbols();
164
        $this->assertCount(1, $symbols);
165
        $this->assertContains('foo', $symbols);
166
    }
167
168
    public function testFunctionParameterType()
169
    {
@@ 232-243 (lines=12) @@
229
        $this->assertContains('Baz', $symbols);
230
    }
231
232
    public function testFunctionReturnType()
233
    {
234
        $functionName = new Name('foo');
235
        $node = new Function_($functionName);
236
        $node->returnType = new Name('Bar');
237
238
        $this->visitor->enterNode($node);
239
240
        $symbols = $this->visitor->getCollectedSymbols();
241
        $this->assertCount(1, $symbols);
242
        $this->assertContains('Bar', $symbols);
243
    }
244
245
    public function testFunctionReturnTypeAsString()
246
    {
@@ 245-256 (lines=12) @@
242
        $this->assertContains('Bar', $symbols);
243
    }
244
245
    public function testFunctionReturnTypeAsString()
246
    {
247
        $functionName = new Name('foo');
248
        $node = new Function_($functionName);
249
        $node->returnType = 'Bar';
250
251
        $this->visitor->enterNode($node);
252
253
        $symbols = $this->visitor->getCollectedSymbols();
254
        $this->assertCount(1, $symbols);
255
        $this->assertContains('Bar', $symbols);
256
    }
257
258
    public function testMethodReturnType()
259
    {
@@ 258-269 (lines=12) @@
255
        $this->assertContains('Bar', $symbols);
256
    }
257
258
    public function testMethodReturnType()
259
    {
260
        $functionName = new Name('foo');
261
        $node = new ClassMethod($functionName);
262
        $node->returnType = new Name('Bar');
263
264
        $this->visitor->enterNode($node);
265
266
        $symbols = $this->visitor->getCollectedSymbols();
267
        $this->assertCount(1, $symbols);
268
        $this->assertContains('Bar', $symbols);
269
    }
270
271
    public function testMethodReturnTypeAsString()
272
    {
@@ 271-282 (lines=12) @@
268
        $this->assertContains('Bar', $symbols);
269
    }
270
271
    public function testMethodReturnTypeAsString()
272
    {
273
        $functionName = new Name('foo');
274
        $node = new ClassMethod($functionName);
275
        $node->returnType = 'Bar';
276
277
        $this->visitor->enterNode($node);
278
279
        $symbols = $this->visitor->getCollectedSymbols();
280
        $this->assertCount(1, $symbols);
281
        $this->assertContains('Bar', $symbols);
282
    }
283
284
    public function testConstantFetch()
285
    {
@@ 284-295 (lines=12) @@
281
        $this->assertContains('Bar', $symbols);
282
    }
283
284
    public function testConstantFetch()
285
    {
286
        $exceptionClass = new Name('FooException');
287
        $node = new ConstFetch($exceptionClass);
288
        $node->name = $exceptionClass;
289
290
        $this->visitor->enterNode($node);
291
292
        $symbols = $this->visitor->getCollectedSymbols();
293
        $this->assertCount(1, $symbols);
294
        $this->assertContains('FooException', $symbols);
295
    }
296
297
    public function testTraits()
298
    {