FormIntegrationTestCase.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.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\Component\Form\Test;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Form\FormFactoryInterface;
  13. use Symfony\Component\Form\Forms;
  14. /**
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. abstract class FormIntegrationTestCase extends TestCase
  18. {
  19. /**
  20. * @var FormFactoryInterface
  21. */
  22. protected $factory;
  23. protected function setUp(): void
  24. {
  25. $this->factory = Forms::createFormFactoryBuilder()
  26. ->addExtensions($this->getExtensions())
  27. ->addTypeExtensions($this->getTypeExtensions())
  28. ->addTypes($this->getTypes())
  29. ->addTypeGuessers($this->getTypeGuessers())
  30. ->getFormFactory();
  31. }
  32. protected function getExtensions()
  33. {
  34. return [];
  35. }
  36. protected function getTypeExtensions()
  37. {
  38. return [];
  39. }
  40. protected function getTypes()
  41. {
  42. return [];
  43. }
  44. protected function getTypeGuessers()
  45. {
  46. return [];
  47. }
  48. }