protected function ChoiceFormFieldTest::createSelectNodeWithEmptyOption in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Tests/Field/ChoiceFormFieldTest.php \Symfony\Component\DomCrawler\Tests\Field\ChoiceFormFieldTest::createSelectNodeWithEmptyOption()
1 call to ChoiceFormFieldTest::createSelectNodeWithEmptyOption()
- ChoiceFormFieldTest::testOptionWithNoValue in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php
File
- vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php, line 368
Class
Namespace
Symfony\Component\DomCrawler\Tests\FieldCode
protected function createSelectNodeWithEmptyOption($options, $attributes = array()) {
$document = new \DOMDocument();
$node = $document
->createElement('select');
foreach ($attributes as $name => $value) {
$node
->setAttribute($name, $value);
}
$node
->setAttribute('name', 'name');
foreach ($options as $value => $selected) {
$option = $document
->createElement('option', $value);
if ($selected) {
$option
->setAttribute('selected', 'selected');
}
$node
->appendChild($option);
}
return $node;
}