Added the Porter Stemmer module to improve searches. This doesn't deal with some...
[yaffs-website] / vendor / symfony / dom-crawler / Tests / Field / TextareaFormFieldTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\DomCrawler\Tests\Field;
13
14 use Symfony\Component\DomCrawler\Field\TextareaFormField;
15
16 class TextareaFormFieldTest extends FormFieldTestCase
17 {
18     public function testInitialize()
19     {
20         $node = $this->createNode('textarea', 'foo bar');
21         $field = new TextareaFormField($node);
22
23         $this->assertEquals('foo bar', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');
24
25         $node = $this->createNode('input', '');
26         try {
27             $field = new TextareaFormField($node);
28             $this->fail('->initialize() throws a \LogicException if the node is not a textarea');
29         } catch (\LogicException $e) {
30             $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea');
31         }
32
33         // Ensure that valid HTML can be used on a textarea.
34         $node = $this->createNode('textarea', 'foo bar <h1>Baz</h1>');
35         $field = new TextareaFormField($node);
36
37         $this->assertEquals('foo bar <h1>Baz</h1>', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');
38
39         // Ensure that we don't do any DOM manipulation/validation by passing in
40         // "invalid" HTML.
41         $node = $this->createNode('textarea', 'foo bar <h1>Baz</h2>');
42         $field = new TextareaFormField($node);
43
44         $this->assertEquals('foo bar <h1>Baz</h2>', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');
45     }
46 }