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 |
||
20 | class StructureResolverTest extends KernelTestCase |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * @var \Symfony\Component\DependencyInjection\ContainerInterface |
||
25 | */ |
||
26 | protected $container; |
||
27 | |||
28 | public function setUp() |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $classContentBeforeUpdate = <<<EOT |
||
38 | <?php |
||
39 | |||
40 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
41 | |||
42 | /** |
||
43 | * User dummy class for StructureResolver tests |
||
44 | */ |
||
45 | class User implements \Symfony\Component\Security\Core\User\UserInterface, \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\CredentialsAwareInterface, \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
46 | { |
||
47 | |||
48 | /** |
||
49 | * 'full_name' property |
||
50 | * @\Symfony\Component\Validator\Constraints\NotBlank() |
||
51 | * @\JMS\Serializer\Annotation\Type("string") |
||
52 | * @\JMS\Serializer\Annotation\SerializedName("full_name") |
||
53 | * @var string |
||
54 | */ |
||
55 | private \$fullName; |
||
56 | |||
57 | /** |
||
58 | * 'email' property |
||
59 | * @\Symfony\Component\Validator\Constraints\Email(message = "Invalid email!") |
||
60 | * @\JMS\Serializer\Annotation\Type("string") |
||
61 | * @\JMS\Serializer\Annotation\SerializedName("email") |
||
62 | * @var string |
||
63 | */ |
||
64 | private \$email; |
||
65 | |||
66 | /** |
||
67 | * Wether user active |
||
68 | * @\Symfony\Component\Validator\Constraints\Type(type='boolean') |
||
69 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
70 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
71 | * @\JMS\Serializer\Annotation\SerializedName("active") |
||
72 | * @var boolean |
||
73 | */ |
||
74 | private \$active; |
||
75 | |||
76 | /** |
||
77 | * User new posts |
||
78 | * @\Symfony\Component\Validator\Constraints\NotNull() |
||
79 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
80 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
||
81 | * @\JMS\Serializer\Annotation\SerializedName("new_posts") |
||
82 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
83 | */ |
||
84 | private \$newPosts; |
||
85 | |||
86 | /** |
||
87 | * 'roles' property |
||
88 | * |
||
89 | * |
||
90 | * @\JMS\Serializer\Annotation\Type("string") |
||
91 | * @\JMS\Serializer\Annotation\SerializedName("roles") |
||
92 | * @var string |
||
93 | */ |
||
94 | private \$roles; |
||
95 | |||
96 | /** |
||
97 | * Constructor. |
||
98 | */ |
||
99 | public function __construct() |
||
100 | { |
||
101 | \$this->newPosts = new \Doctrine\Common\Collections\ArrayCollection(); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * For property "fullName" |
||
106 | * @param string \$fullName |
||
107 | * @return \$this |
||
108 | */ |
||
109 | public function setFullName(\$fullName) |
||
110 | { |
||
111 | \$this->fullName = \$fullName; |
||
112 | return \$this; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * For property "fullName" |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getFullName() |
||
120 | { |
||
121 | return \$this->fullName; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * For property "email" |
||
126 | * @param string \$email |
||
127 | * @return \$this |
||
128 | */ |
||
129 | public function setEmail(\$email) |
||
130 | { |
||
131 | \$this->email = \$email; |
||
132 | return \$this; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * For property "email" |
||
137 | * @return string |
||
138 | */ |
||
139 | public function getEmail() |
||
140 | { |
||
141 | return \$this->email; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * For property "active" |
||
146 | * @return boolean |
||
147 | */ |
||
148 | public function isActive() |
||
149 | { |
||
150 | return (bool) \$this->active; |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * For property "active" |
||
155 | * @param boolean \$active |
||
156 | * @return \$this |
||
157 | */ |
||
158 | public function setActive(\$active) |
||
159 | { |
||
160 | \$this->active = \$active; |
||
161 | return \$this; |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * For property "active" |
||
166 | * @return boolean |
||
167 | */ |
||
168 | public function getActive() |
||
169 | { |
||
170 | return \$this->active; |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * For property "newPosts" |
||
175 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
176 | * @return \$this |
||
177 | */ |
||
178 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts) |
||
179 | { |
||
180 | \$this->newPosts = \$newPosts; |
||
181 | return \$this; |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * For property "newPosts" |
||
186 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
187 | */ |
||
188 | public function getNewPosts() |
||
189 | { |
||
190 | return \$this->newPosts; |
||
191 | } |
||
192 | |||
193 | /** |
||
194 | * For property "roles" |
||
195 | * @param string \$roles |
||
196 | * @return \$this |
||
197 | */ |
||
198 | public function setRoles(\$roles) |
||
199 | { |
||
200 | \$this->roles = \$roles; |
||
201 | return \$this; |
||
202 | } |
||
203 | |||
204 | /** |
||
205 | * For property "roles" |
||
206 | * @return string |
||
207 | */ |
||
208 | public function getRoles() |
||
209 | { |
||
210 | return \$this->roles; |
||
211 | } |
||
212 | |||
213 | /** |
||
214 | * @inheritdoc |
||
215 | */ |
||
216 | public function getCredentials() |
||
217 | { |
||
218 | // TODO: Implement getCredentials() method. |
||
219 | } |
||
220 | |||
221 | /** |
||
222 | * @inheritdoc |
||
223 | */ |
||
224 | public function getPassword() |
||
225 | { |
||
226 | // TODO: Implement getPassword() method. |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * @inheritdoc |
||
231 | */ |
||
232 | public function getSalt() |
||
233 | { |
||
234 | // TODO: Implement getSalt() method. |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * @inheritdoc |
||
239 | */ |
||
240 | public function getUsername() |
||
241 | { |
||
242 | // TODO: Implement getUsername() method. |
||
243 | } |
||
244 | |||
245 | /** |
||
246 | * @inheritdoc |
||
247 | */ |
||
248 | public function eraseCredentials() |
||
249 | { |
||
250 | // TODO: Implement eraseCredentials() method. |
||
251 | } |
||
252 | |||
253 | } |
||
254 | |||
255 | EOT; |
||
256 | |||
257 | /** |
||
258 | * @var string |
||
259 | */ |
||
260 | protected $classContentAfterUpdate = <<<EOT |
||
261 | <?php |
||
262 | |||
263 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
264 | |||
265 | /** |
||
266 | * User dummy class for StructureResolver tests |
||
267 | */ |
||
268 | class User implements \Symfony\Component\Security\Core\User\UserInterface, \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\CredentialsAwareInterface, \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
269 | { |
||
270 | |||
271 | /** |
||
272 | * 'full_name' property |
||
273 | * @\Symfony\Component\Validator\Constraints\NotBlank() |
||
274 | * @\JMS\Serializer\Annotation\Type("string") |
||
275 | * @\JMS\Serializer\Annotation\SerializedName("full_name") |
||
276 | * @var string |
||
277 | */ |
||
278 | private \$fullName; |
||
279 | |||
280 | /** |
||
281 | * 'email' property |
||
282 | * @\Symfony\Component\Validator\Constraints\Email(message = "Invalid email!") |
||
283 | * @\JMS\Serializer\Annotation\Type("string") |
||
284 | * @\JMS\Serializer\Annotation\SerializedName("email") |
||
285 | * @var string |
||
286 | */ |
||
287 | private \$email; |
||
288 | |||
289 | /** |
||
290 | * Wether user active |
||
291 | * @\Symfony\Component\Validator\Constraints\Type(type='boolean') |
||
292 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
293 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
294 | * @\JMS\Serializer\Annotation\SerializedName("active") |
||
295 | * @var boolean |
||
296 | */ |
||
297 | private \$active; |
||
298 | |||
299 | /** |
||
300 | * User new posts |
||
301 | * @\Symfony\Component\Validator\Constraints\NotNull() |
||
302 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
303 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection<AppBundle\Entity\Post>") |
||
304 | * @\JMS\Serializer\Annotation\SerializedName("new_posts") |
||
305 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
306 | */ |
||
307 | private \$newPosts; |
||
308 | |||
309 | /** |
||
310 | * 'roles' property |
||
311 | * |
||
312 | * |
||
313 | * @\JMS\Serializer\Annotation\Type("string") |
||
314 | * @\JMS\Serializer\Annotation\SerializedName("roles") |
||
315 | * @var string |
||
316 | */ |
||
317 | private \$roles; |
||
318 | |||
319 | /** |
||
320 | * new collection property |
||
321 | * |
||
322 | * @\Symfony\Component\Validator\Constraints\Valid() |
||
323 | * @\JMS\Serializer\Annotation\Type("Doctrine\Common\Collections\ArrayCollection") |
||
324 | * @\JMS\Serializer\Annotation\SerializedName("test_collection") |
||
325 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
326 | */ |
||
327 | private \$testCollection; |
||
328 | |||
329 | /** |
||
330 | * new boolean property |
||
331 | * |
||
332 | * @\Symfony\Component\Validator\Constraints\IsTrue() |
||
333 | * @\JMS\Serializer\Annotation\Type("boolean") |
||
334 | * @\JMS\Serializer\Annotation\SerializedName("test_boolean") |
||
335 | * @var boolean |
||
336 | */ |
||
337 | private \$testBoolean; |
||
338 | |||
339 | /** |
||
340 | * Constructor. |
||
341 | */ |
||
342 | public function __construct() |
||
343 | { |
||
344 | \$this->newPosts = new \Doctrine\Common\Collections\ArrayCollection(); |
||
345 | \$this->testCollection = new \Doctrine\Common\Collections\ArrayCollection(); |
||
346 | } |
||
347 | |||
348 | /** |
||
349 | * For property "fullName" |
||
350 | * @param string \$fullName |
||
351 | * @return \$this |
||
352 | */ |
||
353 | public function setFullName(\$fullName) |
||
354 | { |
||
355 | \$this->fullName = \$fullName; |
||
356 | return \$this; |
||
357 | } |
||
358 | |||
359 | /** |
||
360 | * For property "fullName" |
||
361 | * @return string |
||
362 | */ |
||
363 | public function getFullName() |
||
364 | { |
||
365 | return \$this->fullName; |
||
366 | } |
||
367 | |||
368 | /** |
||
369 | * For property "email" |
||
370 | * @param string \$email |
||
371 | * @return \$this |
||
372 | */ |
||
373 | public function setEmail(\$email) |
||
374 | { |
||
375 | \$this->email = \$email; |
||
376 | return \$this; |
||
377 | } |
||
378 | |||
379 | /** |
||
380 | * For property "email" |
||
381 | * @return string |
||
382 | */ |
||
383 | public function getEmail() |
||
384 | { |
||
385 | return \$this->email; |
||
386 | } |
||
387 | |||
388 | /** |
||
389 | * For property "active" |
||
390 | * @return boolean |
||
391 | */ |
||
392 | public function isActive() |
||
393 | { |
||
394 | return (bool) \$this->active; |
||
395 | } |
||
396 | |||
397 | /** |
||
398 | * For property "active" |
||
399 | * @param boolean \$active |
||
400 | * @return \$this |
||
401 | */ |
||
402 | public function setActive(\$active) |
||
403 | { |
||
404 | \$this->active = \$active; |
||
405 | return \$this; |
||
406 | } |
||
407 | |||
408 | /** |
||
409 | * For property "active" |
||
410 | * @return boolean |
||
411 | */ |
||
412 | public function getActive() |
||
413 | { |
||
414 | return \$this->active; |
||
415 | } |
||
416 | |||
417 | /** |
||
418 | * For property "newPosts" |
||
419 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
420 | * @return \$this |
||
421 | */ |
||
422 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts) |
||
423 | { |
||
424 | \$this->newPosts = \$newPosts; |
||
425 | return \$this; |
||
426 | } |
||
427 | |||
428 | /** |
||
429 | * For property "newPosts" |
||
430 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
431 | */ |
||
432 | public function getNewPosts() |
||
433 | { |
||
434 | return \$this->newPosts; |
||
435 | } |
||
436 | |||
437 | /** |
||
438 | * For property "roles" |
||
439 | * @param string \$roles |
||
440 | * @return \$this |
||
441 | */ |
||
442 | public function setRoles(\$roles) |
||
443 | { |
||
444 | \$this->roles = \$roles; |
||
445 | return \$this; |
||
446 | } |
||
447 | |||
448 | /** |
||
449 | * For property "roles" |
||
450 | * @return string |
||
451 | */ |
||
452 | public function getRoles() |
||
453 | { |
||
454 | return \$this->roles; |
||
455 | } |
||
456 | |||
457 | /** |
||
458 | * @inheritdoc |
||
459 | */ |
||
460 | public function getCredentials() |
||
461 | { |
||
462 | // TODO: Implement getCredentials() method. |
||
463 | } |
||
464 | |||
465 | /** |
||
466 | * @inheritdoc |
||
467 | */ |
||
468 | public function getPassword() |
||
469 | { |
||
470 | // TODO: Implement getPassword() method. |
||
471 | } |
||
472 | |||
473 | /** |
||
474 | * @inheritdoc |
||
475 | */ |
||
476 | public function getSalt() |
||
477 | { |
||
478 | // TODO: Implement getSalt() method. |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * @inheritdoc |
||
483 | */ |
||
484 | public function getUsername() |
||
485 | { |
||
486 | // TODO: Implement getUsername() method. |
||
487 | } |
||
488 | |||
489 | /** |
||
490 | * @inheritdoc |
||
491 | */ |
||
492 | public function eraseCredentials() |
||
493 | { |
||
494 | // TODO: Implement eraseCredentials() method. |
||
495 | } |
||
496 | |||
497 | /** |
||
498 | * For property "testCollection" |
||
499 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
500 | */ |
||
501 | public function getTestCollection() |
||
502 | { |
||
503 | return \$this->testCollection; |
||
504 | } |
||
505 | |||
506 | /** |
||
507 | * For property "testCollection" |
||
508 | * @param \Doctrine\Common\Collections\ArrayCollection \$testCollection |
||
509 | * @return \$this |
||
510 | */ |
||
511 | public function setTestCollection(\Doctrine\Common\Collections\ArrayCollection \$testCollection) |
||
512 | { |
||
513 | \$this->testCollection = \$testCollection; |
||
514 | return \$this; |
||
515 | } |
||
516 | |||
517 | /** |
||
518 | * For property "testBoolean" |
||
519 | * @return boolean |
||
520 | */ |
||
521 | public function getTestBoolean() |
||
522 | { |
||
523 | return \$this->testBoolean; |
||
524 | } |
||
525 | |||
526 | /** |
||
527 | * For property "testBoolean" |
||
528 | * @param boolean \$testBoolean |
||
529 | * @return \$this |
||
530 | */ |
||
531 | public function setTestBoolean(\$testBoolean) |
||
532 | { |
||
533 | \$this->testBoolean = \$testBoolean; |
||
534 | return \$this; |
||
535 | } |
||
536 | |||
537 | /** |
||
538 | * For property "testBoolean" |
||
539 | * @return boolean |
||
540 | */ |
||
541 | public function isTestBoolean() |
||
542 | { |
||
543 | return (bool) \$this->testBoolean; |
||
544 | } |
||
545 | |||
546 | } |
||
547 | |||
548 | EOT; |
||
549 | |||
550 | /** |
||
551 | * @var string |
||
552 | */ |
||
553 | protected $interfaceContentBeforeUpdate = <<<EOT |
||
554 | <?php |
||
555 | |||
556 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
557 | |||
558 | /** |
||
559 | * User dummy interface for StructureResolver tests |
||
560 | */ |
||
561 | interface UserInterface |
||
562 | { |
||
563 | |||
564 | /** |
||
565 | * For property "fullName" |
||
566 | * @param string \$fullName |
||
567 | * @return \$this |
||
568 | */ |
||
569 | public function setFullName(\$fullName); |
||
570 | |||
571 | /** |
||
572 | * For property "fullName" |
||
573 | * @return string |
||
574 | */ |
||
575 | public function getFullName(); |
||
576 | |||
577 | /** |
||
578 | * For property "email" |
||
579 | * @param string \$email |
||
580 | * @return \$this |
||
581 | */ |
||
582 | public function setEmail(\$email); |
||
583 | |||
584 | /** |
||
585 | * For property "email" |
||
586 | * @return string |
||
587 | */ |
||
588 | public function getEmail(); |
||
589 | |||
590 | /** |
||
591 | * For property "active" |
||
592 | * @return boolean |
||
593 | */ |
||
594 | public function isActive(); |
||
595 | |||
596 | /** |
||
597 | * For property "active" |
||
598 | * @param boolean \$active |
||
599 | * @return \$this |
||
600 | */ |
||
601 | public function setActive(\$active); |
||
602 | |||
603 | /** |
||
604 | * For property "active" |
||
605 | * @return boolean |
||
606 | */ |
||
607 | public function getActive(); |
||
608 | |||
609 | /** |
||
610 | * For property "newPosts" |
||
611 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
612 | * @return \$this |
||
613 | */ |
||
614 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts); |
||
615 | |||
616 | /** |
||
617 | * For property "newPosts" |
||
618 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
619 | */ |
||
620 | public function getNewPosts(); |
||
621 | |||
622 | /** |
||
623 | * For property "roles" |
||
624 | * @param string \$roles |
||
625 | * @return \$this |
||
626 | */ |
||
627 | public function setRoles(\$roles); |
||
628 | |||
629 | /** |
||
630 | * For property "roles" |
||
631 | * @return string |
||
632 | */ |
||
633 | public function getRoles(); |
||
634 | |||
635 | } |
||
636 | |||
637 | EOT; |
||
638 | protected $interfaceContentAfterUpdate = <<<EOT |
||
639 | <?php |
||
640 | |||
641 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
642 | |||
643 | /** |
||
644 | * User dummy interface for StructureResolver tests |
||
645 | */ |
||
646 | interface UserInterface |
||
647 | { |
||
648 | |||
649 | /** |
||
650 | * For property "fullName" |
||
651 | * @param string \$fullName |
||
652 | * @return \$this |
||
653 | */ |
||
654 | public function setFullName(\$fullName); |
||
655 | |||
656 | /** |
||
657 | * For property "fullName" |
||
658 | * @return string |
||
659 | */ |
||
660 | public function getFullName(); |
||
661 | |||
662 | /** |
||
663 | * For property "email" |
||
664 | * @param string \$email |
||
665 | * @return \$this |
||
666 | */ |
||
667 | public function setEmail(\$email); |
||
668 | |||
669 | /** |
||
670 | * For property "email" |
||
671 | * @return string |
||
672 | */ |
||
673 | public function getEmail(); |
||
674 | |||
675 | /** |
||
676 | * For property "active" |
||
677 | * @return boolean |
||
678 | */ |
||
679 | public function isActive(); |
||
680 | |||
681 | /** |
||
682 | * For property "active" |
||
683 | * @param boolean \$active |
||
684 | * @return \$this |
||
685 | */ |
||
686 | public function setActive(\$active); |
||
687 | |||
688 | /** |
||
689 | * For property "active" |
||
690 | * @return boolean |
||
691 | */ |
||
692 | public function getActive(); |
||
693 | |||
694 | /** |
||
695 | * For property "newPosts" |
||
696 | * @param \Doctrine\Common\Collections\ArrayCollection \$newPosts |
||
697 | * @return \$this |
||
698 | */ |
||
699 | public function setNewPosts(\Doctrine\Common\Collections\ArrayCollection \$newPosts); |
||
700 | |||
701 | /** |
||
702 | * For property "newPosts" |
||
703 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
704 | */ |
||
705 | public function getNewPosts(); |
||
706 | |||
707 | /** |
||
708 | * For property "roles" |
||
709 | * @param string \$roles |
||
710 | * @return \$this |
||
711 | */ |
||
712 | public function setRoles(\$roles); |
||
713 | |||
714 | /** |
||
715 | * For property "roles" |
||
716 | * @return string |
||
717 | */ |
||
718 | public function getRoles(); |
||
719 | |||
720 | /** |
||
721 | * For property "testCollection" |
||
722 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
723 | */ |
||
724 | public function getTestCollection(); |
||
725 | |||
726 | /** |
||
727 | * For property "testCollection" |
||
728 | * @param \Doctrine\Common\Collections\ArrayCollection \$testCollection |
||
729 | * @return \$this |
||
730 | */ |
||
731 | public function setTestCollection(\Doctrine\Common\Collections\ArrayCollection \$testCollection); |
||
732 | |||
733 | /** |
||
734 | * For property "testBoolean" |
||
735 | * @return boolean |
||
736 | */ |
||
737 | public function getTestBoolean(); |
||
738 | |||
739 | /** |
||
740 | * For property "testBoolean" |
||
741 | * @param boolean \$testBoolean |
||
742 | * @return \$this |
||
743 | */ |
||
744 | public function setTestBoolean(\$testBoolean); |
||
745 | |||
746 | /** |
||
747 | * For property "testBoolean" |
||
748 | * @return boolean |
||
749 | */ |
||
750 | public function isTestBoolean(); |
||
751 | |||
752 | } |
||
753 | |||
754 | EOT; |
||
755 | |||
756 | /** |
||
757 | * @var string |
||
758 | */ |
||
759 | protected $testClassContentBeforeUpdate = <<<EOT |
||
760 | <?php |
||
761 | |||
762 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
763 | |||
764 | /** |
||
765 | * User dummy test class for StructureResolver tests |
||
766 | */ |
||
767 | class UserTestDummy extends \PHPUnit_Framework_TestCase |
||
768 | { |
||
769 | |||
770 | /** |
||
771 | * Entity to test |
||
772 | * @var \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
773 | */ |
||
774 | private \$object = null; |
||
775 | |||
776 | public function setUp() |
||
777 | { |
||
778 | \$this->object = new \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User(); |
||
779 | } |
||
780 | |||
781 | public function testConstructor() |
||
782 | { |
||
783 | \$this->assertNotNull(\$this->object); |
||
784 | \$this->assertInstanceof('\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface', \$this->object); |
||
785 | \$this->assertInstanceof('\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User', \$this->object); |
||
786 | } |
||
787 | |||
788 | /** |
||
789 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setFullName |
||
790 | */ |
||
791 | public function testSetFullName() |
||
792 | { |
||
793 | \$this->markTestIncomplete( |
||
794 | 'This test has not been implemented yet.' |
||
795 | ); |
||
796 | } |
||
797 | |||
798 | /** |
||
799 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getFullName |
||
800 | */ |
||
801 | public function testGetFullName() |
||
802 | { |
||
803 | \$this->markTestIncomplete( |
||
804 | 'This test has not been implemented yet.' |
||
805 | ); |
||
806 | } |
||
807 | |||
808 | /** |
||
809 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setEmail |
||
810 | */ |
||
811 | public function testSetEmail() |
||
812 | { |
||
813 | \$this->markTestIncomplete( |
||
814 | 'This test has not been implemented yet.' |
||
815 | ); |
||
816 | } |
||
817 | |||
818 | /** |
||
819 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getEmail |
||
820 | */ |
||
821 | public function testGetEmail() |
||
822 | { |
||
823 | \$this->markTestIncomplete( |
||
824 | 'This test has not been implemented yet.' |
||
825 | ); |
||
826 | } |
||
827 | |||
828 | /** |
||
829 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isActive |
||
830 | */ |
||
831 | public function testIsActive() |
||
832 | { |
||
833 | \$this->markTestIncomplete( |
||
834 | 'This test has not been implemented yet.' |
||
835 | ); |
||
836 | } |
||
837 | |||
838 | /** |
||
839 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setActive |
||
840 | */ |
||
841 | public function testSetActive() |
||
842 | { |
||
843 | \$this->markTestIncomplete( |
||
844 | 'This test has not been implemented yet.' |
||
845 | ); |
||
846 | } |
||
847 | |||
848 | /** |
||
849 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getActive |
||
850 | */ |
||
851 | public function testGetActive() |
||
852 | { |
||
853 | \$this->markTestIncomplete( |
||
854 | 'This test has not been implemented yet.' |
||
855 | ); |
||
856 | } |
||
857 | |||
858 | /** |
||
859 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setNewPosts |
||
860 | */ |
||
861 | public function testSetNewPosts() |
||
862 | { |
||
863 | \$this->markTestIncomplete( |
||
864 | 'This test has not been implemented yet.' |
||
865 | ); |
||
866 | } |
||
867 | |||
868 | /** |
||
869 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getNewPosts |
||
870 | */ |
||
871 | public function testGetNewPosts() |
||
872 | { |
||
873 | \$this->markTestIncomplete( |
||
874 | 'This test has not been implemented yet.' |
||
875 | ); |
||
876 | } |
||
877 | |||
878 | /** |
||
879 | * @covers \AppBundle\Entity\User::setRoles |
||
880 | */ |
||
881 | public function testSetRoles() |
||
882 | { |
||
883 | \$this->markTestIncomplete( |
||
884 | 'This test has not been implemented yet.' |
||
885 | ); |
||
886 | } |
||
887 | |||
888 | /** |
||
889 | * @covers \AppBundle\Entity\User::getRoles |
||
890 | */ |
||
891 | public function testGetRoles() |
||
892 | { |
||
893 | \$this->markTestIncomplete( |
||
894 | 'This test has not been implemented yet.' |
||
895 | ); |
||
896 | } |
||
897 | |||
898 | } |
||
899 | |||
900 | EOT; |
||
901 | |||
902 | /** |
||
903 | * @var string |
||
904 | */ |
||
905 | protected $testClassContentAfterUpdate = <<<EOT |
||
906 | <?php |
||
907 | |||
908 | namespace SimpleEntityGeneratorBundle\Tests\Lib\Dummies; |
||
909 | |||
910 | /** |
||
911 | * User dummy test class for StructureResolver tests |
||
912 | */ |
||
913 | class UserTestDummy extends \PHPUnit_Framework_TestCase |
||
914 | { |
||
915 | |||
916 | /** |
||
917 | * Entity to test |
||
918 | * @var \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface |
||
919 | */ |
||
920 | private \$object = null; |
||
921 | |||
922 | public function setUp() |
||
923 | { |
||
924 | \$this->object = new \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User(); |
||
925 | } |
||
926 | |||
927 | public function testConstructor() |
||
928 | { |
||
929 | \$this->assertNotNull(\$this->object); |
||
930 | \$this->assertInstanceof('\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\UserInterface', \$this->object); |
||
931 | \$this->assertInstanceof('\SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User', \$this->object); |
||
932 | } |
||
933 | |||
934 | /** |
||
935 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setFullName |
||
936 | */ |
||
937 | public function testSetFullName() |
||
938 | { |
||
939 | \$this->markTestIncomplete( |
||
940 | 'This test has not been implemented yet.' |
||
941 | ); |
||
942 | } |
||
943 | |||
944 | /** |
||
945 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getFullName |
||
946 | */ |
||
947 | public function testGetFullName() |
||
948 | { |
||
949 | \$this->markTestIncomplete( |
||
950 | 'This test has not been implemented yet.' |
||
951 | ); |
||
952 | } |
||
953 | |||
954 | /** |
||
955 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setEmail |
||
956 | */ |
||
957 | public function testSetEmail() |
||
958 | { |
||
959 | \$this->markTestIncomplete( |
||
960 | 'This test has not been implemented yet.' |
||
961 | ); |
||
962 | } |
||
963 | |||
964 | /** |
||
965 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getEmail |
||
966 | */ |
||
967 | public function testGetEmail() |
||
968 | { |
||
969 | \$this->markTestIncomplete( |
||
970 | 'This test has not been implemented yet.' |
||
971 | ); |
||
972 | } |
||
973 | |||
974 | /** |
||
975 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isActive |
||
976 | */ |
||
977 | public function testIsActive() |
||
978 | { |
||
979 | \$this->markTestIncomplete( |
||
980 | 'This test has not been implemented yet.' |
||
981 | ); |
||
982 | } |
||
983 | |||
984 | /** |
||
985 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setActive |
||
986 | */ |
||
987 | public function testSetActive() |
||
988 | { |
||
989 | \$this->markTestIncomplete( |
||
990 | 'This test has not been implemented yet.' |
||
991 | ); |
||
992 | } |
||
993 | |||
994 | /** |
||
995 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getActive |
||
996 | */ |
||
997 | public function testGetActive() |
||
998 | { |
||
999 | \$this->markTestIncomplete( |
||
1000 | 'This test has not been implemented yet.' |
||
1001 | ); |
||
1002 | } |
||
1003 | |||
1004 | /** |
||
1005 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setNewPosts |
||
1006 | */ |
||
1007 | public function testSetNewPosts() |
||
1008 | { |
||
1009 | \$this->markTestIncomplete( |
||
1010 | 'This test has not been implemented yet.' |
||
1011 | ); |
||
1012 | } |
||
1013 | |||
1014 | /** |
||
1015 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getNewPosts |
||
1016 | */ |
||
1017 | public function testGetNewPosts() |
||
1018 | { |
||
1019 | \$this->markTestIncomplete( |
||
1020 | 'This test has not been implemented yet.' |
||
1021 | ); |
||
1022 | } |
||
1023 | |||
1024 | /** |
||
1025 | * @covers \AppBundle\Entity\User::setRoles |
||
1026 | */ |
||
1027 | public function testSetRoles() |
||
1028 | { |
||
1029 | \$this->markTestIncomplete( |
||
1030 | 'This test has not been implemented yet.' |
||
1031 | ); |
||
1032 | } |
||
1033 | |||
1034 | /** |
||
1035 | * @covers \AppBundle\Entity\User::getRoles |
||
1036 | */ |
||
1037 | public function testGetRoles() |
||
1038 | { |
||
1039 | \$this->markTestIncomplete( |
||
1040 | 'This test has not been implemented yet.' |
||
1041 | ); |
||
1042 | } |
||
1043 | |||
1044 | /** |
||
1045 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getTestCollection |
||
1046 | */ |
||
1047 | public function testGetTestCollection() |
||
1048 | { |
||
1049 | \$this->markTestIncomplete( |
||
1050 | 'This test has not been implemented yet.' |
||
1051 | ); |
||
1052 | } |
||
1053 | |||
1054 | /** |
||
1055 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setTestCollection |
||
1056 | */ |
||
1057 | public function testSetTestCollection() |
||
1058 | { |
||
1059 | \$this->markTestIncomplete( |
||
1060 | 'This test has not been implemented yet.' |
||
1061 | ); |
||
1062 | } |
||
1063 | |||
1064 | /** |
||
1065 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::getTestBoolean |
||
1066 | */ |
||
1067 | public function testGetTestBoolean() |
||
1068 | { |
||
1069 | \$this->markTestIncomplete( |
||
1070 | 'This test has not been implemented yet.' |
||
1071 | ); |
||
1072 | } |
||
1073 | |||
1074 | /** |
||
1075 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::setTestBoolean |
||
1076 | */ |
||
1077 | public function testSetTestBoolean() |
||
1078 | { |
||
1079 | \$this->markTestIncomplete( |
||
1080 | 'This test has not been implemented yet.' |
||
1081 | ); |
||
1082 | } |
||
1083 | |||
1084 | /** |
||
1085 | * @covers \SimpleEntityGeneratorBundle\Tests\Lib\Dummies\User::isTestBoolean |
||
1086 | */ |
||
1087 | public function testIsTestBoolean() |
||
1088 | { |
||
1089 | \$this->markTestIncomplete( |
||
1090 | 'This test has not been implemented yet.' |
||
1091 | ); |
||
1092 | } |
||
1093 | |||
1094 | } |
||
1095 | |||
1096 | EOT; |
||
1097 | |||
1098 | View Code Duplication | public function testGetUpdatedItemSourceContentForClassManager() |
|
1108 | |||
1109 | View Code Duplication | public function testGetUpdatedItemSourceContentForInterfaceManager() |
|
1120 | |||
1121 | View Code Duplication | public function testGetUpdatedItemSourceContentForTestClassManager() |
|
1133 | |||
1134 | /** |
||
1135 | * Prepare correct ClassManager |
||
1136 | * @return ClassManager |
||
1137 | * @internal param ArrayCollection $newProperties |
||
1138 | */ |
||
1139 | protected function prepareClassManager() |
||
1152 | |||
1153 | /** |
||
1154 | * @param mixed $itemOrDirectory |
||
1155 | * @return string |
||
1156 | * @throws Exception |
||
1157 | */ |
||
1158 | protected function getContentFile($itemOrDirectory) |
||
1171 | |||
1172 | /** |
||
1173 | * @param mixed $itemOrNamespace |
||
1174 | * @return ReflectionClass |
||
1175 | * @throws Exception |
||
1176 | */ |
||
1177 | protected function getReflectionClass($itemOrNamespace) |
||
1190 | |||
1191 | /** |
||
1192 | * @return FilesManager |
||
1193 | */ |
||
1194 | protected function getFilesManager() |
||
1198 | |||
1199 | /** |
||
1200 | * @return StructureResolver |
||
1201 | */ |
||
1202 | protected function getStructureResolver() |
||
1206 | |||
1207 | /** |
||
1208 | * @return \Symfony\Component\HttpKernel\KernelInterface |
||
1209 | */ |
||
1210 | protected function getKernel() |
||
1214 | } |
||
1215 |
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.