X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fdom-crawler%2FTests%2FField%2FTextareaFormFieldTest.php;fp=vendor%2Fsymfony%2Fdom-crawler%2FTests%2FField%2FTextareaFormFieldTest.php;h=5d4d0038260db35c0311181d307bcb892b3d610b;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/symfony/dom-crawler/Tests/Field/TextareaFormFieldTest.php b/vendor/symfony/dom-crawler/Tests/Field/TextareaFormFieldTest.php new file mode 100644 index 000000000..5d4d00382 --- /dev/null +++ b/vendor/symfony/dom-crawler/Tests/Field/TextareaFormFieldTest.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Tests\Field; + +use Symfony\Component\DomCrawler\Field\TextareaFormField; + +class TextareaFormFieldTest extends FormFieldTestCase +{ + public function testInitialize() + { + $node = $this->createNode('textarea', 'foo bar'); + $field = new TextareaFormField($node); + + $this->assertEquals('foo bar', $field->getValue(), '->initialize() sets the value of the field to the textarea node value'); + + $node = $this->createNode('input', ''); + try { + $field = new TextareaFormField($node); + $this->fail('->initialize() throws a \LogicException if the node is not a textarea'); + } catch (\LogicException $e) { + $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea'); + } + + // Ensure that valid HTML can be used on a textarea. + $node = $this->createNode('textarea', 'foo bar

Baz

'); + $field = new TextareaFormField($node); + + $this->assertEquals('foo bar

Baz

', $field->getValue(), '->initialize() sets the value of the field to the textarea node value'); + + // Ensure that we don't do any DOM manipulation/validation by passing in + // "invalid" HTML. + $node = $this->createNode('textarea', 'foo bar

Baz

'); + $field = new TextareaFormField($node); + + $this->assertEquals('foo bar

Baz

', $field->getValue(), '->initialize() sets the value of the field to the textarea node value'); + } +}