HiddenFieldTest.php 655 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Symfony\Tests\Component\Form;
  3. use Symfony\Component\Form\HiddenField;
  4. class HiddenFieldTest extends \PHPUnit_Framework_TestCase
  5. {
  6. protected $field;
  7. public function setUp()
  8. {
  9. $this->field = new HiddenField('name');
  10. }
  11. public function testRender()
  12. {
  13. $this->field->setData('foobar');
  14. $html = '<input id="name" name="name" value="foobar" type="hidden" class="foobar" />';
  15. $this->assertEquals($html, $this->field->render(array(
  16. 'class' => 'foobar',
  17. )));
  18. }
  19. public function testIsHidden()
  20. {
  21. $this->assertTrue($this->field->isHidden());
  22. }
  23. }