HiddenFieldTest.php 711 B

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