AbstractExtensionTest.php 993 B

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