public function FormTest::testGetSetValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Tests/FormTest.php \Symfony\Component\DomCrawler\Tests\FormTest::testGetSetValue()
File
- vendor/
symfony/ dom-crawler/ Tests/ FormTest.php, line 323
Class
Namespace
Symfony\Component\DomCrawler\TestsCode
public function testGetSetValue() {
$form = $this
->createForm('<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>');
$this
->assertEquals('foo', $form['foo']
->getValue(), '->offsetGet() returns the value of a form field');
$form['foo'] = 'bar';
$this
->assertEquals('bar', $form['foo']
->getValue(), '->offsetSet() changes the value of a form field');
try {
$form['foobar'] = 'bar';
$this
->fail('->offsetSet() throws an \\InvalidArgumentException exception if the field does not exist');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(true, '->offsetSet() throws an \\InvalidArgumentException exception if the field does not exist');
}
try {
$form['foobar'];
$this
->fail('->offsetSet() throws an \\InvalidArgumentException exception if the field does not exist');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(true, '->offsetSet() throws an \\InvalidArgumentException exception if the field does not exist');
}
}