AbstractExtensionTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\Tests\Component\Form;
  11. use Symfony\Component\Form\AbstractExtension;
  12. use Symfony\Component\Form\FormTypeInterface;
  13. use Symfony\Component\Form\FormInterface;
  14. use Symfony\Component\Form\FormView;
  15. use Symfony\Component\Form\FormFactoryInterface;
  16. use Symfony\Component\Form\FormBuilder;
  17. use Symfony\Tests\Component\Form\Fixtures\FooType;
  18. class AbstractExtensionTest extends \PHPUnit_Framework_TestCase
  19. {
  20. public function testHasType()
  21. {
  22. $loader = new ConcreteExtension();
  23. $this->assertTrue($loader->hasType('foo'));
  24. $this->assertFalse($loader->hasType('bar'));
  25. }
  26. public function testGetType()
  27. {
  28. $loader = new ConcreteExtension();
  29. $this->assertTrue($loader->getType('foo') instanceof FooType);
  30. }
  31. }
  32. class ConcreteExtension extends AbstractExtension
  33. {
  34. protected function loadTypes()
  35. {
  36. return array(new FooType());
  37. }
  38. protected function loadTypeGuesser()
  39. {
  40. }
  41. }