These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\PagePartBundle\Tests\Form; |
||
4 | |||
5 | use Kunstmaan\NodeBundle\Form\Type\URLChooserType; |
||
6 | use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser; |
||
7 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
||
8 | use Symfony\Component\EventDispatcher\EventDispatcher; |
||
9 | use Symfony\Component\Form\FormBuilder; |
||
10 | use Symfony\Component\Form\Forms; |
||
11 | |||
12 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||
13 | |||
14 | /** |
||
15 | * PagePartAdminTypeTestCase |
||
16 | */ |
||
17 | View Code Duplication | class PagePartAdminTypeTestCase extends WebTestCase |
|
0 ignored issues
–
show
|
|||
18 | { |
||
19 | /** |
||
20 | * @var FormBuilder |
||
21 | */ |
||
22 | protected $builder; |
||
23 | |||
24 | /** |
||
25 | * @var EventDispatcher |
||
26 | */ |
||
27 | protected $dispatcher; |
||
28 | |||
29 | /** |
||
30 | * @var \Symfony\Component\Form\FormFactoryInterface |
||
31 | */ |
||
32 | protected $factory; |
||
33 | |||
34 | /** |
||
35 | * @var OptionsResolver |
||
36 | */ |
||
37 | protected $resolver; |
||
38 | |||
39 | /** |
||
40 | * Sets up the fixture, for example, opens a network connection. |
||
41 | * This method is called before a test is executed. |
||
42 | */ |
||
43 | protected function setUp() |
||
44 | { |
||
45 | $formFactoryBuilderInterface = Forms::createFormFactoryBuilder(); |
||
46 | $formFactoryBuilderInterface->addType(new URLChooserType()); |
||
47 | $formFactoryBuilderInterface->addTypeGuesser(new DoctrineOrmTypeGuesser($this->getMock('Doctrine\Common\Persistence\ManagerRegistry'))); |
||
48 | $this->factory = $formFactoryBuilderInterface->getFormFactory(); |
||
49 | $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); |
||
50 | $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); |
||
51 | $this->resolver = new OptionsResolver(); |
||
52 | } |
||
53 | } |
||
54 |
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.