TextareaFormFieldTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\Components\DomCrawler\Field;
  11. require_once __DIR__.'/FormFieldTestCase.php';
  12. use Symfony\Components\DomCrawler\Field\TextareaFormField;
  13. class TextareaFormFieldTest extends FormFieldTestCase
  14. {
  15. public function testInitialize()
  16. {
  17. $node = $this->createNode('textarea', 'foo bar');
  18. $field = new TextareaFormField($node);
  19. $this->assertEquals('foo bar', $field->getValue(), '->initialize() sets the value of the field to the textare node value');
  20. $node = $this->createNode('input', '');
  21. try
  22. {
  23. $field = new TextareaFormField($node);
  24. $this->fail('->initialize() throws a \LogicException if the node is not a textarea');
  25. }
  26. catch (\LogicException $e)
  27. {
  28. $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea');
  29. }
  30. }
  31. }