Completed
Pull Request — 5.0 (#2162)
by Kevin
14:33
created

MediaBundle/Tests/Form/AbstractTypeTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Kunstmaan\MediaBundle\Tests\Form;
3
4
use Kunstmaan\NodeBundle\Form\Type\URLChooserType;
5
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
use Symfony\Component\EventDispatcher\EventDispatcher;
8
use Symfony\Component\Form\FormBuilder;
9
use Symfony\Component\Form\Forms;
10
use Symfony\Component\OptionsResolver\OptionsResolver;
11
12
/**
13
 * AbstractTypeTestCase
14
 */
15 View Code Duplication
abstract class AbstractTypeTest extends WebTestCase
0 ignored issues
show
This class seems to be duplicated in your project.

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.

Loading history...
16
{
17
    /**
18
     * @var FormBuilder
19
     */
20
    protected $builder;
21
22
    /**
23
     * @var EventDispatcher
24
     */
25
    protected $dispatcher;
26
27
    /**
28
     * @var \Symfony\Component\Form\FormFactoryInterface
29
     */
30
    protected $factory;
31
32
    /**
33
     * @var OptionsResolver
34
     */
35
    protected $resolver;
36
37
    /**
38
     * Sets up the fixture, for example, opens a network connection.
39
     * This method is called before a test is executed.
40
     */
41
    protected function setUp()
42
    {
43
        $formFactoryBuilderInterface = Forms::createFormFactoryBuilder();
44
        $formFactoryBuilderInterface->addType(new URLChooserType());
45
        $formFactoryBuilderInterface->addTypeGuesser(new DoctrineOrmTypeGuesser($this->getMock('Doctrine\Common\Persistence\ManagerRegistry')));
46
        $this->factory = $formFactoryBuilderInterface->getFormFactory();
47
        $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
48
        $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
49
        $this->resolver = new OptionsResolver();
50
    }
51
}
52