Test/TypeTestCase.php
<?php
namespace Beelab\UserBundle\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
abstract class TypeTestCase extends TestCase
{
/**
* @var FormFactoryInterface
*/
protected $factory;
/**
* @var FormBuilder
*/
protected $builder;
/**
* @var EventDispatcher
*/
protected $dispatcher;
protected function setUp(): void
{
$this->factory = Forms::createFormFactoryBuilder()
->addExtensions($this->getExtensions())
->getFormFactory();
$this->dispatcher = $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
}
protected function getExtensions()
{
return array();
}
}