TestCase.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\Form;
  11. use Symfony\Component\Form\FieldBuilder;
  12. use Symfony\Component\Form\FormFactory;
  13. use Symfony\Component\Form\Config\Loader\DefaultConfigLoader;
  14. use Symfony\Component\EventDispatcher\EventDispatcher;
  15. class TestCase extends \PHPUnit_Framework_TestCase
  16. {
  17. protected $theme;
  18. protected $csrfProvider;
  19. protected $validator;
  20. protected $storage;
  21. private $em;
  22. protected $factory;
  23. protected $builder;
  24. protected function setUp()
  25. {
  26. $this->theme = $this->getMock('Symfony\Component\Form\Renderer\Theme\ThemeInterface');
  27. $this->csrfProvider = $this->getMock('Symfony\Component\Form\CsrfProvider\CsrfProviderInterface');
  28. $this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
  29. $this->storage = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\TemporaryStorage')
  30. ->disableOriginalConstructor()
  31. ->getMock();
  32. $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
  33. ->disableOriginalConstructor()
  34. ->getMock();
  35. $loader = new DefaultConfigLoader();
  36. $this->factory = new FormFactory($loader);
  37. $loader->initialize($this->factory, $this->theme, $this->csrfProvider,
  38. $this->validator, $this->storage, $this->em);
  39. $this->builder = new FieldBuilder($this->theme, new EventDispatcher(), $this->csrfProvider);
  40. }
  41. }