This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/Form/Renderer/Plugin/ChoicePluginTest.php

56 lines
1.9 KiB
PHP
Raw Normal View History

2011-03-22 20:51:19 +00:00
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Component\Form\Renderer\Plugin;
use Symfony\Component\Form\Renderer\Plugin\ChoicePlugin;
class ChoicePluginTest extends \PHPUnit_Framework_TestCase
{
public function testSetUp()
{
2011-03-22 22:19:51 +00:00
$choice = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
$choice->expects($this->any())
2011-03-22 20:51:19 +00:00
->method('getOtherChoices')
->will($this->returnValue('somechoices'));
2011-03-22 22:19:51 +00:00
$choice->expects($this->any())
2011-03-22 20:51:19 +00:00
->method('getPreferredChoices')
->will($this->returnValue('somethingelse'));
2011-03-22 22:19:51 +00:00
$field = $this->getMock('Symfony\Tests\Component\Form\FormInterface');
$renderer = $this->getMock('Symfony\Component\Form\Renderer\FormRendererInterface');
2011-03-22 20:51:19 +00:00
$renderer->expects($this->at(0))
->method('setVar')
->with($this->equalTo('choices'), $this->equalTo('somechoices'));
$renderer->expects($this->at(1))
->method('setVar')
->with($this->equalTo('preferred_choices'), $this->equalTo('somethingelse'));
$renderer->expects($this->at(2))
->method('setVar')
->with($this->equalTo('separator'), $this->equalTo('-------------------'));
$renderer->expects($this->at(3))
->method('setVar')
2011-03-22 22:19:51 +00:00
->with($this->equalTo('choice_list'), $this->equalTo($choice));
2011-03-22 20:51:19 +00:00
$renderer->expects($this->at(4))
->method('setVar')
->with($this->equalTo('empty_value'), $this->equalTo(''));
2011-03-22 22:19:51 +00:00
$plugin = new ChoicePlugin($choice);
$plugin->setUp($field, $renderer);
2011-03-22 20:51:19 +00:00
}
}