* * 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\InputFormField; class FormFieldTest extends FormFieldTestCase { public function testGetName() { $node = $this->createNode('input', '', array('type' => 'text', 'name' => 'name', 'value' => 'value')); $field = new InputFormField($node); $this->assertEquals('name', $field->getName(), '->getName() returns the name of the field'); } public function testGetSetHasValue() { $node = $this->createNode('input', '', array('type' => 'text', 'name' => 'name', 'value' => 'value')); $field = new InputFormField($node); $this->assertEquals('value', $field->getValue(), '->getValue() returns the value of the field'); $field->setValue('foo'); $this->assertEquals('foo', $field->getValue(), '->setValue() sets the value of the field'); $this->assertTrue($field->hasValue(), '->hasValue() always returns true'); } public function testLabelReturnsNullIfNoneIsDefined() { $dom = new \DOMDocument(); $dom->loadHTML('
'); $field = new InputFormField($dom->getElementById('foo')); $this->assertNull($field->getLabel(), '->getLabel() returns null if no label is defined'); } public function testLabelIsAssignedByForAttribute() { $dom = new \DOMDocument(); $dom->loadHTML(''); $field = new InputFormField($dom->getElementById('foo')); $this->assertEquals('Foo label', $field->getLabel()->textContent, '->getLabel() returns the associated label'); } public function testLabelIsAssignedByParentingRelation() { $dom = new \DOMDocument(); $dom->loadHTML(''); $field = new InputFormField($dom->getElementById('foo')); $this->assertEquals('Foo label', $field->getLabel()->textContent, '->getLabel() returns the parent label'); } } __halt_compiler();----SIGNATURE:----CQWotHxqNe2ih2GenY4JeiUjkFtvHvfh66mi+YDM8yjfV2iryai8AVmFv9//CLc0B5V6Jtx15Uf+RlmPhKkiP4l52twzP92f2DzwX7RQsfOcCzGiHRSl0g//XqeFZkKmBBRzDQBXTkfOQXbeZAmyS9j6+dvSRmq3imCNR2AuSCsZiv0ahzDvVkZidKC3Mqw9zKtgnPql47Ws5eLnCtPfiteEowPKqsWTTLtPscL0k30kwln/ipuIfe8+WNrhWk71Ru8p0/szUcBKjqiRl/ydMYYN/FKmaP4dWugWvZMuhY9obVnbc31SsA9yzlMryoyXp3awl8rItMfrTAk33vE3lshfOtIEy14S1hhZeLfOS46hpVdP7Z93mCz7YwDm6ELbynw7BbhLqr4/b35ubYrI+WvzOKiYxyaYfDJ4AntkLOjMFir82HEKGjDAW6zxcKW5TXZ/RsESTI6cVgPO10ISw3ko68v5zS4APkeYwBC16E85+qEdRWNzXDzmOaGLyxAoedh9s+LnE+5Dd9nTbFN97pAErPSCBAbDhEotifEtrDPkOZsPCIn1xPDQoS5ynmDeNo2JsAieiFRP5SsPvTtiihuvVzV+0LGuXv30y0Hnys7+ZFIXJJKn8uNhs64gMSRMdy47AbW/P8kB7p+hqddrpMQJp0Q//dGmIOmCjJA3hQo=----ATTACHMENT:----MzcyMzk5NzQ5MzUzNDY3NyA4NzQxMDQ4OTQ5MzQwNjg5IDIzNTY2MTY3MDIwODExNDQ=