Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
16 | class StructureResolverTest extends KernelTestCase |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var \Symfony\Component\DependencyInjection\ContainerInterface |
||
21 | */ |
||
22 | protected $container; |
||
23 | |||
24 | public function setUp() |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $classContentBeforeUpdate = <<<EOT |
||
34 | <?php |
||
35 | |||
36 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
37 | |||
38 | /** |
||
39 | * User dummy class for StructureResolver tests |
||
40 | */ |
||
41 | class User implements \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
42 | { |
||
43 | |||
44 | /** |
||
45 | * 'full_name' property |
||
46 | * @\Symfony\Component\Validator\Constraints\NotBlank() |
||
47 | * @\JMS\Serializer\Annotation\Type("string") |
||
48 | * @\JMS\Serializer\Annotation\SerializedName("full_name") |
||
49 | * @var string |
||
50 | */ |
||
51 | private \$fullName; |
||
52 | |||
53 | /** |
||
54 | * 'email' property |
||
55 | * @\Symfony\Component\Validator\Constraints\Email(message = "Invalid email!") |
||
56 | * @\JMS\Serializer\Annotation\Type("string") |
||
57 | * @\JMS\Serializer\Annotation\SerializedName("email") |
||
58 | * @var string |
||
59 | */ |
||
60 | private \$email; |
||
61 | |||
62 | /** |
||
63 | * Wether user active |
||
64 | * @\Symfony\Component\Validator\Constraints\Type(type='boolean') |
||
65 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
66 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
67 | * @\JMS\Serializer\Annotation\SerializedName("active") |
||
68 | * @var boolean |
||
69 | */ |
||
70 | private \$active; |
||
71 | |||
72 | /** |
||
73 | * User new posts |
||
74 | * @\Symfony\Component\Validator\Constraints\NotNull() |
||
75 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
76 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
||
77 | * @\JMS\Serializer\Annotation\SerializedName("new_posts") |
||
78 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
79 | */ |
||
80 | private \$newPosts; |
||
81 | |||
82 | /** |
||
83 | * Constructor. |
||
84 | */ |
||
85 | public function __construct() |
||
86 | { |
||
87 | \$this->newPosts = new \Doctrine\Common\Collections\ArrayCollection(); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * For property "fullName" |
||
92 | * @param string \$fullName |
||
93 | * @return \$this |
||
94 | */ |
||
95 | public function setFullName(\$fullName) |
||
96 | { |
||
97 | \$this->fullName = \$fullName; |
||
98 | return \$this; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * For property "fullName" |
||
103 | * @return string |
||
104 | */ |
||
105 | public function getFullName() |
||
106 | { |
||
107 | return \$this->fullName; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * For property "email" |
||
112 | * @param string \$email |
||
113 | * @return \$this |
||
114 | */ |
||
115 | public function setEmail(\$email) |
||
116 | { |
||
117 | \$this->email = \$email; |
||
118 | return \$this; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * For property "email" |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getEmail() |
||
126 | { |
||
127 | return \$this->email; |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * For property "active" |
||
132 | * @return boolean |
||
133 | */ |
||
134 | public function isActive() |
||
135 | { |
||
136 | return (bool) \$this->active; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * For property "active" |
||
141 | * @param boolean \$active |
||
142 | * @return \$this |
||
143 | */ |
||
144 | public function setActive(\$active) |
||
145 | { |
||
146 | \$this->active = \$active; |
||
147 | return \$this; |
||
148 | } |
||
149 | |||
150 | /** |
||
151 | * For property "active" |
||
152 | * @return boolean |
||
153 | */ |
||
154 | public function getActive() |
||
155 | { |
||
156 | return \$this->active; |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * For property "newPosts" |
||
161 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
162 | * @return \$this |
||
163 | */ |
||
164 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts) |
||
165 | { |
||
166 | \$this->newPosts = \$newPosts; |
||
167 | return \$this; |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * For property "newPosts" |
||
172 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
173 | */ |
||
174 | public function getNewPosts() |
||
175 | { |
||
176 | return \$this->newPosts; |
||
177 | } |
||
178 | |||
179 | } |
||
180 | |||
181 | EOT; |
||
182 | |||
183 | /** |
||
184 | * @var string |
||
185 | */ |
||
186 | protected $classContentAfterUpdate = <<<EOT |
||
187 | <?php |
||
188 | |||
189 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
190 | |||
191 | /** |
||
192 | * User dummy class for StructureResolver tests |
||
193 | */ |
||
194 | class User implements \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
195 | { |
||
196 | |||
197 | /** |
||
198 | * 'full_name' property |
||
199 | * @\Symfony\Component\Validator\Constraints\NotBlank() |
||
200 | * @\JMS\Serializer\Annotation\Type("string") |
||
201 | * @\JMS\Serializer\Annotation\SerializedName("full_name") |
||
202 | * @var string |
||
203 | */ |
||
204 | private \$fullName; |
||
205 | |||
206 | /** |
||
207 | * 'email' property |
||
208 | * @\Symfony\Component\Validator\Constraints\Email(message = "Invalid email!") |
||
209 | * @\JMS\Serializer\Annotation\Type("string") |
||
210 | * @\JMS\Serializer\Annotation\SerializedName("email") |
||
211 | * @var string |
||
212 | */ |
||
213 | private \$email; |
||
214 | |||
215 | /** |
||
216 | * Wether user active |
||
217 | * @\Symfony\Component\Validator\Constraints\Type(type='boolean') |
||
218 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
219 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
220 | * @\JMS\Serializer\Annotation\SerializedName("active") |
||
221 | * @var boolean |
||
222 | */ |
||
223 | private \$active; |
||
224 | |||
225 | /** |
||
226 | * User new posts |
||
227 | * @\Symfony\Component\Validator\Constraints\NotNull() |
||
228 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
229 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
||
230 | * @\JMS\Serializer\Annotation\SerializedName("new_posts") |
||
231 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
232 | */ |
||
233 | private \$newPosts; |
||
234 | |||
235 | /** |
||
236 | * new collection property |
||
237 | * |
||
238 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
239 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection") |
||
240 | * @\JMS\Serializer\Annotation\SerializedName("test_collection") |
||
241 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
242 | */ |
||
243 | private \$testCollection; |
||
244 | |||
245 | /** |
||
246 | * new boolean property |
||
247 | * |
||
248 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
249 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
250 | * @\JMS\Serializer\Annotation\SerializedName("test_boolean") |
||
251 | * @var boolean |
||
252 | */ |
||
253 | private \$testBoolean; |
||
254 | |||
255 | /** |
||
256 | * Constructor. |
||
257 | */ |
||
258 | public function __construct() |
||
259 | { |
||
260 | \$this->newPosts = new \Doctrine\Common\Collections\ArrayCollection(); |
||
261 | \$this->testCollection = new \Doctrine\Common\Collections\ArrayCollection(); |
||
262 | } |
||
263 | |||
264 | /** |
||
265 | * For property "fullName" |
||
266 | * @param string \$fullName |
||
267 | * @return \$this |
||
268 | */ |
||
269 | public function setFullName(\$fullName) |
||
270 | { |
||
271 | \$this->fullName = \$fullName; |
||
272 | return \$this; |
||
273 | } |
||
274 | |||
275 | /** |
||
276 | * For property "fullName" |
||
277 | * @return string |
||
278 | */ |
||
279 | public function getFullName() |
||
280 | { |
||
281 | return \$this->fullName; |
||
282 | } |
||
283 | |||
284 | /** |
||
285 | * For property "email" |
||
286 | * @param string \$email |
||
287 | * @return \$this |
||
288 | */ |
||
289 | public function setEmail(\$email) |
||
290 | { |
||
291 | \$this->email = \$email; |
||
292 | return \$this; |
||
293 | } |
||
294 | |||
295 | /** |
||
296 | * For property "email" |
||
297 | * @return string |
||
298 | */ |
||
299 | public function getEmail() |
||
300 | { |
||
301 | return \$this->email; |
||
302 | } |
||
303 | |||
304 | /** |
||
305 | * For property "active" |
||
306 | * @return boolean |
||
307 | */ |
||
308 | public function isActive() |
||
309 | { |
||
310 | return (bool) \$this->active; |
||
311 | } |
||
312 | |||
313 | /** |
||
314 | * For property "active" |
||
315 | * @param boolean \$active |
||
316 | * @return \$this |
||
317 | */ |
||
318 | public function setActive(\$active) |
||
319 | { |
||
320 | \$this->active = \$active; |
||
321 | return \$this; |
||
322 | } |
||
323 | |||
324 | /** |
||
325 | * For property "active" |
||
326 | * @return boolean |
||
327 | */ |
||
328 | public function getActive() |
||
329 | { |
||
330 | return \$this->active; |
||
331 | } |
||
332 | |||
333 | /** |
||
334 | * For property "newPosts" |
||
335 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
336 | * @return \$this |
||
337 | */ |
||
338 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts) |
||
339 | { |
||
340 | \$this->newPosts = \$newPosts; |
||
341 | return \$this; |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | * For property "newPosts" |
||
346 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
347 | */ |
||
348 | public function getNewPosts() |
||
349 | { |
||
350 | return \$this->newPosts; |
||
351 | } |
||
352 | |||
353 | /** |
||
354 | * For property "testCollection" |
||
355 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
356 | */ |
||
357 | public function getTestCollection() |
||
358 | { |
||
359 | return \$this->testCollection; |
||
360 | } |
||
361 | |||
362 | /** |
||
363 | * For property "testCollection" |
||
364 | * @param \Doctrine\Common\Collections\ArrayCollection \$testCollection |
||
365 | * @return \$this |
||
366 | */ |
||
367 | public function setTestCollection(\Doctrine\Common\Collections\ArrayCollection \$testCollection) |
||
368 | { |
||
369 | \$this->testCollection = \$testCollection; |
||
370 | return \$this; |
||
371 | } |
||
372 | |||
373 | /** |
||
374 | * For property "testBoolean" |
||
375 | * @return boolean |
||
376 | */ |
||
377 | public function getTestBoolean() |
||
378 | { |
||
379 | return \$this->testBoolean; |
||
380 | } |
||
381 | |||
382 | /** |
||
383 | * For property "testBoolean" |
||
384 | * @param boolean \$testBoolean |
||
385 | * @return \$this |
||
386 | */ |
||
387 | public function setTestBoolean(\$testBoolean) |
||
388 | { |
||
389 | \$this->testBoolean = \$testBoolean; |
||
390 | return \$this; |
||
391 | } |
||
392 | |||
393 | /** |
||
394 | * For property "testBoolean" |
||
395 | * @return boolean |
||
396 | */ |
||
397 | public function isTestBoolean() |
||
398 | { |
||
399 | return (bool) \$this->testBoolean; |
||
400 | } |
||
401 | |||
402 | } |
||
403 | |||
404 | EOT; |
||
405 | |||
406 | /** |
||
407 | * @var string |
||
408 | */ |
||
409 | protected $interfaceContentBeforeUpdate = <<<EOT |
||
410 | <?php |
||
411 | |||
412 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
413 | |||
414 | /** |
||
415 | * User dummy interface for StructureResolver tests |
||
416 | */ |
||
417 | interface UserInterface |
||
418 | { |
||
419 | |||
420 | /** |
||
421 | * For property "fullName" |
||
422 | * @param string \$fullName |
||
423 | * @return \$this |
||
424 | */ |
||
425 | public function setFullName(\$fullName); |
||
426 | |||
427 | /** |
||
428 | * For property "fullName" |
||
429 | * @return string |
||
430 | */ |
||
431 | public function getFullName(); |
||
432 | |||
433 | /** |
||
434 | * For property "email" |
||
435 | * @param string \$email |
||
436 | * @return \$this |
||
437 | */ |
||
438 | public function setEmail(\$email); |
||
439 | |||
440 | /** |
||
441 | * For property "email" |
||
442 | * @return string |
||
443 | */ |
||
444 | public function getEmail(); |
||
445 | |||
446 | /** |
||
447 | * For property "active" |
||
448 | * @return boolean |
||
449 | */ |
||
450 | public function isActive(); |
||
451 | |||
452 | /** |
||
453 | * For property "active" |
||
454 | * @param boolean \$active |
||
455 | * @return \$this |
||
456 | */ |
||
457 | public function setActive(\$active); |
||
458 | |||
459 | /** |
||
460 | * For property "active" |
||
461 | * @return boolean |
||
462 | */ |
||
463 | public function getActive(); |
||
464 | |||
465 | /** |
||
466 | * For property "newPosts" |
||
467 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
468 | * @return \$this |
||
469 | */ |
||
470 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts); |
||
471 | |||
472 | /** |
||
473 | * For property "newPosts" |
||
474 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
475 | */ |
||
476 | public function getNewPosts(); |
||
477 | |||
478 | } |
||
479 | |||
480 | EOT; |
||
481 | protected $interfaceContentAfterUpdate = <<<EOT |
||
482 | <?php |
||
483 | |||
484 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
485 | |||
486 | /** |
||
487 | * User dummy interface for StructureResolver tests |
||
488 | */ |
||
489 | interface UserInterface |
||
490 | { |
||
491 | |||
492 | /** |
||
493 | * For property "fullName" |
||
494 | * @param string \$fullName |
||
495 | * @return \$this |
||
496 | */ |
||
497 | public function setFullName(\$fullName); |
||
498 | |||
499 | /** |
||
500 | * For property "fullName" |
||
501 | * @return string |
||
502 | */ |
||
503 | public function getFullName(); |
||
504 | |||
505 | /** |
||
506 | * For property "email" |
||
507 | * @param string \$email |
||
508 | * @return \$this |
||
509 | */ |
||
510 | public function setEmail(\$email); |
||
511 | |||
512 | /** |
||
513 | * For property "email" |
||
514 | * @return string |
||
515 | */ |
||
516 | public function getEmail(); |
||
517 | |||
518 | /** |
||
519 | * For property "active" |
||
520 | * @return boolean |
||
521 | */ |
||
522 | public function isActive(); |
||
523 | |||
524 | /** |
||
525 | * For property "active" |
||
526 | * @param boolean \$active |
||
527 | * @return \$this |
||
528 | */ |
||
529 | public function setActive(\$active); |
||
530 | |||
531 | /** |
||
532 | * For property "active" |
||
533 | * @return boolean |
||
534 | */ |
||
535 | public function getActive(); |
||
536 | |||
537 | /** |
||
538 | * For property "newPosts" |
||
539 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
540 | * @return \$this |
||
541 | */ |
||
542 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts); |
||
543 | |||
544 | /** |
||
545 | * For property "newPosts" |
||
546 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
547 | */ |
||
548 | public function getNewPosts(); |
||
549 | |||
550 | /** |
||
551 | * For property "testCollection" |
||
552 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
553 | */ |
||
554 | public function getTestCollection(); |
||
555 | |||
556 | /** |
||
557 | * For property "testCollection" |
||
558 | * @param \Doctrine\Common\Collections\ArrayCollection \$testCollection |
||
559 | * @return \$this |
||
560 | */ |
||
561 | public function setTestCollection(\Doctrine\Common\Collections\ArrayCollection \$testCollection); |
||
562 | |||
563 | /** |
||
564 | * For property "testBoolean" |
||
565 | * @return boolean |
||
566 | */ |
||
567 | public function getTestBoolean(); |
||
568 | |||
569 | /** |
||
570 | * For property "testBoolean" |
||
571 | * @param boolean \$testBoolean |
||
572 | * @return \$this |
||
573 | */ |
||
574 | public function setTestBoolean(\$testBoolean); |
||
575 | |||
576 | /** |
||
577 | * For property "testBoolean" |
||
578 | * @return boolean |
||
579 | */ |
||
580 | public function isTestBoolean(); |
||
581 | |||
582 | } |
||
583 | |||
584 | EOT; |
||
585 | |||
586 | /** |
||
587 | * @var string |
||
588 | */ |
||
589 | protected $testClassContentBeforeUpdate = <<<EOT |
||
590 | <?php |
||
591 | |||
592 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
593 | |||
594 | /** |
||
595 | * User dummy test class for StructureResolver tests |
||
596 | */ |
||
597 | class UserTestDummy extends \PHPUnit_Framework_TestCase |
||
598 | { |
||
599 | |||
600 | /** |
||
601 | * Entity to test |
||
602 | * @var \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
603 | */ |
||
604 | private \$object = null; |
||
605 | |||
606 | public function setUp() |
||
607 | { |
||
608 | \$this->object = new \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User(); |
||
609 | } |
||
610 | |||
611 | public function testConstructor() |
||
612 | { |
||
613 | \$this->assertNotNull(\$this->object); |
||
614 | \$this->assertInstanceof('\HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface', \$this->object); |
||
615 | \$this->assertInstanceof('\HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User', \$this->object); |
||
616 | } |
||
617 | |||
618 | /** |
||
619 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setFullName |
||
620 | */ |
||
621 | public function testSetFullName() |
||
622 | { |
||
623 | \$this->markTestIncomplete( |
||
624 | 'This test has not been implemented yet.' |
||
625 | ); |
||
626 | } |
||
627 | |||
628 | /** |
||
629 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getFullName |
||
630 | */ |
||
631 | public function testGetFullName() |
||
632 | { |
||
633 | \$this->markTestIncomplete( |
||
634 | 'This test has not been implemented yet.' |
||
635 | ); |
||
636 | } |
||
637 | |||
638 | /** |
||
639 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setEmail |
||
640 | */ |
||
641 | public function testSetEmail() |
||
642 | { |
||
643 | \$this->markTestIncomplete( |
||
644 | 'This test has not been implemented yet.' |
||
645 | ); |
||
646 | } |
||
647 | |||
648 | /** |
||
649 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getEmail |
||
650 | */ |
||
651 | public function testGetEmail() |
||
652 | { |
||
653 | \$this->markTestIncomplete( |
||
654 | 'This test has not been implemented yet.' |
||
655 | ); |
||
656 | } |
||
657 | |||
658 | /** |
||
659 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isActive |
||
660 | */ |
||
661 | public function testIsActive() |
||
662 | { |
||
663 | \$this->markTestIncomplete( |
||
664 | 'This test has not been implemented yet.' |
||
665 | ); |
||
666 | } |
||
667 | |||
668 | /** |
||
669 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setActive |
||
670 | */ |
||
671 | public function testSetActive() |
||
672 | { |
||
673 | \$this->markTestIncomplete( |
||
674 | 'This test has not been implemented yet.' |
||
675 | ); |
||
676 | } |
||
677 | |||
678 | /** |
||
679 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getActive |
||
680 | */ |
||
681 | public function testGetActive() |
||
682 | { |
||
683 | \$this->markTestIncomplete( |
||
684 | 'This test has not been implemented yet.' |
||
685 | ); |
||
686 | } |
||
687 | |||
688 | /** |
||
689 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setNewPosts |
||
690 | */ |
||
691 | public function testSetNewPosts() |
||
692 | { |
||
693 | \$this->markTestIncomplete( |
||
694 | 'This test has not been implemented yet.' |
||
695 | ); |
||
696 | } |
||
697 | |||
698 | /** |
||
699 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getNewPosts |
||
700 | */ |
||
701 | public function testGetNewPosts() |
||
702 | { |
||
703 | \$this->markTestIncomplete( |
||
704 | 'This test has not been implemented yet.' |
||
705 | ); |
||
706 | } |
||
707 | |||
708 | } |
||
709 | |||
710 | EOT; |
||
711 | |||
712 | /** |
||
713 | * @var string |
||
714 | */ |
||
715 | protected $testClassContentAfterUpdate = <<<EOT |
||
716 | <?php |
||
717 | |||
718 | namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
719 | |||
720 | /** |
||
721 | * User dummy test class for StructureResolver tests |
||
722 | */ |
||
723 | class UserTestDummy extends \PHPUnit_Framework_TestCase |
||
724 | { |
||
725 | |||
726 | /** |
||
727 | * Entity to test |
||
728 | * @var \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
729 | */ |
||
730 | private \$object = null; |
||
731 | |||
732 | public function setUp() |
||
733 | { |
||
734 | \$this->object = new \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User(); |
||
735 | } |
||
736 | |||
737 | public function testConstructor() |
||
738 | { |
||
739 | \$this->assertNotNull(\$this->object); |
||
740 | \$this->assertInstanceof('\HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface', \$this->object); |
||
741 | \$this->assertInstanceof('\HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User', \$this->object); |
||
742 | } |
||
743 | |||
744 | /** |
||
745 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setFullName |
||
746 | */ |
||
747 | public function testSetFullName() |
||
748 | { |
||
749 | \$this->markTestIncomplete( |
||
750 | 'This test has not been implemented yet.' |
||
751 | ); |
||
752 | } |
||
753 | |||
754 | /** |
||
755 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getFullName |
||
756 | */ |
||
757 | public function testGetFullName() |
||
758 | { |
||
759 | \$this->markTestIncomplete( |
||
760 | 'This test has not been implemented yet.' |
||
761 | ); |
||
762 | } |
||
763 | |||
764 | /** |
||
765 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setEmail |
||
766 | */ |
||
767 | public function testSetEmail() |
||
768 | { |
||
769 | \$this->markTestIncomplete( |
||
770 | 'This test has not been implemented yet.' |
||
771 | ); |
||
772 | } |
||
773 | |||
774 | /** |
||
775 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getEmail |
||
776 | */ |
||
777 | public function testGetEmail() |
||
778 | { |
||
779 | \$this->markTestIncomplete( |
||
780 | 'This test has not been implemented yet.' |
||
781 | ); |
||
782 | } |
||
783 | |||
784 | /** |
||
785 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isActive |
||
786 | */ |
||
787 | public function testIsActive() |
||
788 | { |
||
789 | \$this->markTestIncomplete( |
||
790 | 'This test has not been implemented yet.' |
||
791 | ); |
||
792 | } |
||
793 | |||
794 | /** |
||
795 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setActive |
||
796 | */ |
||
797 | public function testSetActive() |
||
798 | { |
||
799 | \$this->markTestIncomplete( |
||
800 | 'This test has not been implemented yet.' |
||
801 | ); |
||
802 | } |
||
803 | |||
804 | /** |
||
805 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getActive |
||
806 | */ |
||
807 | public function testGetActive() |
||
808 | { |
||
809 | \$this->markTestIncomplete( |
||
810 | 'This test has not been implemented yet.' |
||
811 | ); |
||
812 | } |
||
813 | |||
814 | /** |
||
815 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setNewPosts |
||
816 | */ |
||
817 | public function testSetNewPosts() |
||
818 | { |
||
819 | \$this->markTestIncomplete( |
||
820 | 'This test has not been implemented yet.' |
||
821 | ); |
||
822 | } |
||
823 | |||
824 | /** |
||
825 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getNewPosts |
||
826 | */ |
||
827 | public function testGetNewPosts() |
||
828 | { |
||
829 | \$this->markTestIncomplete( |
||
830 | 'This test has not been implemented yet.' |
||
831 | ); |
||
832 | } |
||
833 | |||
834 | /** |
||
835 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getTestCollection |
||
836 | */ |
||
837 | public function testGetTestCollection() |
||
838 | { |
||
839 | \$this->markTestIncomplete( |
||
840 | 'This test has not been implemented yet.' |
||
841 | ); |
||
842 | } |
||
843 | |||
844 | /** |
||
845 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setTestCollection |
||
846 | */ |
||
847 | public function testSetTestCollection() |
||
848 | { |
||
849 | \$this->markTestIncomplete( |
||
850 | 'This test has not been implemented yet.' |
||
851 | ); |
||
852 | } |
||
853 | |||
854 | /** |
||
855 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getTestBoolean |
||
856 | */ |
||
857 | public function testGetTestBoolean() |
||
858 | { |
||
859 | \$this->markTestIncomplete( |
||
860 | 'This test has not been implemented yet.' |
||
861 | ); |
||
862 | } |
||
863 | |||
864 | /** |
||
865 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setTestBoolean |
||
866 | */ |
||
867 | public function testSetTestBoolean() |
||
868 | { |
||
869 | \$this->markTestIncomplete( |
||
870 | 'This test has not been implemented yet.' |
||
871 | ); |
||
872 | } |
||
873 | |||
874 | /** |
||
875 | * @covers \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isTestBoolean |
||
876 | */ |
||
877 | public function testIsTestBoolean() |
||
878 | { |
||
879 | \$this->markTestIncomplete( |
||
880 | 'This test has not been implemented yet.' |
||
881 | ); |
||
882 | } |
||
883 | |||
884 | } |
||
885 | |||
886 | EOT; |
||
887 | |||
888 | View Code Duplication | public function testGetUpdatedItemSourceContentForClassManager() |
|
898 | |||
899 | View Code Duplication | public function testGetUpdatedItemSourceContentForInterfaceManager() |
|
910 | |||
911 | public function testGetUpdatedItemSourceContentForTestClassManager() |
||
924 | |||
925 | /** |
||
926 | * Prepare correct ClassManager |
||
927 | * |
||
928 | * @param $newProperties ArrayCollection |
||
929 | * @return ClassManager |
||
930 | */ |
||
931 | protected function preapareClassManager() |
||
944 | |||
945 | /** |
||
946 | * @param mixed $itemOrDirectory |
||
947 | * @return string |
||
948 | */ |
||
949 | protected function getContentFile($itemOrDirectory) |
||
962 | |||
963 | /** |
||
964 | * @param mixed $itemOrNamespace |
||
965 | * @return ReflectionClass |
||
966 | */ |
||
967 | protected function getReflectionClass($itemOrNamespace) |
||
980 | |||
981 | /** |
||
982 | * @return \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\FilesManager |
||
983 | */ |
||
984 | protected function getFilesManager() |
||
988 | |||
989 | /** |
||
990 | * @return \HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\StructureResolver |
||
991 | */ |
||
992 | protected function getStructureResolver() |
||
996 | |||
997 | /** |
||
998 | * @return \Symfony\Component\HttpKernel\KernelInterface |
||
999 | */ |
||
1000 | protected function getKernel() |
||
1004 | } |
||
1005 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.