CheckedPluginTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\Renderer\Plugin;
  11. use Symfony\Component\Form\Renderer\Plugin\CheckedPlugin;
  12. class CheckedPluginTest extends \PHPUnit_Framework_TestCase
  13. {
  14. protected function setUp()
  15. {
  16. $this->markTestSkipped('Move me to Type tests');
  17. }
  18. public function testSetUpTrue()
  19. {
  20. $form = $this->getMock('Symfony\Tests\Component\Form\FormInterface');
  21. $form->expects($this->once())
  22. ->method('getData')
  23. ->will($this->returnValue(1));
  24. $renderer = $this->getMock('Symfony\Component\Form\Renderer\FormRendererInterface');
  25. $renderer->expects($this->once())
  26. ->method('setVar')
  27. ->with($this->equalTo('checked'), $this->equalTo(true));
  28. $plugin = new CheckedPlugin();
  29. $plugin->setUp($form, $renderer);
  30. }
  31. public function testSetUpFalse()
  32. {
  33. $form = $this->getMock('Symfony\Tests\Component\Form\FormInterface');
  34. $form->expects($this->once())
  35. ->method('getData')
  36. ->will($this->returnValue(0));
  37. $renderer = $this->getMock('Symfony\Component\Form\Renderer\FormRendererInterface');
  38. $renderer->expects($this->once())
  39. ->method('setVar')
  40. ->with($this->equalTo('checked'), $this->equalTo(false));
  41. $plugin = new CheckedPlugin();
  42. $plugin->setUp($form, $renderer);
  43. }
  44. }