Code Duplication    Length = 12-12 lines in 11 locations

test/ComposerRequireCheckerTest/NodeVisitor/UsedSymbolCollectorTest.php 11 locations

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