* * 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:----X89ygnS8PLyuhyr9L41S6U56s59nZyALSJgqYpwA76EobX4n+1n3+P6qeXKszzCFCPL4/psdI8yESJQN6Ms1PeI7k4d6unj6xmTLD8bgMCcFcr8DJVCDXUPqs5/S83NUwmGfXSYSMziXriidePZ92GehDF5iIUlfFxgVC1LhdwQfZobLYlqaHPFvPlEr83Wl5jPoxFyRsuP/aKUo6YN1QLArGLS8RSJi176T2JLL6qD+85G6ww7qtURTZbkviy6Uf/5AXYlDDFh5sQgdmgT2IYqVIftl/IYRmpMcsduY85NK7Qo/hcvWdtxZuX34K0W+gVYV1jJ8fLBh6jJHNCiefy984NAl8ZmeK9xA//LcD/Yq/1Tp8gRzfPL2QDgr7+iGmrtWCVYek+YyL354Sl79GxjKyc94okxaMEjdApRM3jAZQmkBc61ccpHcIKpZpg0VDmbEojpohKMiAKPLaFrAkEBb+b8ud9EMB7887qjLUkn4uquxJ94mOiGaN1fPnm9nyvbyVZiQCZ8mPGjyttE/2UJj2NOjUKQ/Dnch2lo8BB0WP0vAkl2omDhSbEvWLvaZ2iFCf5lJeqlGpY6jIzqrPub9iMzEiWakBWEj4XqEn27aga3sj0cwVeBbuse+NsAhXFTao7VOTNwoKHMS0yAEx/chwC7jvQ6MiYQHEeqtwlE=----ATTACHMENT:----NzM0MTQ4ODI2ODYwMTM1NyA0NjkxMjMzNDY2MTAyMTUwIDYyMzYwNzg5NzQzNDYxNw==