ChoicePluginTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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\ChoicePlugin;
  12. class ChoicePluginTest extends \PHPUnit_Framework_TestCase
  13. {
  14. protected function setUp()
  15. {
  16. $this->markTestSkipped('Move me to Type tests');
  17. }
  18. public function testSetUp()
  19. {
  20. $choice = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
  21. $choice->expects($this->any())
  22. ->method('getOtherChoices')
  23. ->will($this->returnValue('somechoices'));
  24. $choice->expects($this->any())
  25. ->method('getPreferredChoices')
  26. ->will($this->returnValue('somethingelse'));
  27. $form = $this->getMock('Symfony\Tests\Component\Form\FormInterface');
  28. $renderer = $this->getMock('Symfony\Component\Form\Renderer\FormRendererInterface');
  29. $renderer->expects($this->at(0))
  30. ->method('setVar')
  31. ->with($this->equalTo('choices'), $this->equalTo('somechoices'));
  32. $renderer->expects($this->at(1))
  33. ->method('setVar')
  34. ->with($this->equalTo('preferred_choices'), $this->equalTo('somethingelse'));
  35. $renderer->expects($this->at(2))
  36. ->method('setVar')
  37. ->with($this->equalTo('separator'), $this->equalTo('-------------------'));
  38. $renderer->expects($this->at(3))
  39. ->method('setVar')
  40. ->with($this->equalTo('choice_list'), $this->equalTo($choice));
  41. $renderer->expects($this->at(4))
  42. ->method('setVar')
  43. ->with($this->equalTo('empty_value'), $this->equalTo(''));
  44. $plugin = new ChoicePlugin($choice);
  45. $plugin->setUp($form, $renderer);
  46. }
  47. }