protected function ChoiceFormFieldTest::createSelectNode in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/dom-crawler/Tests/Field/ChoiceFormFieldTest.php \Symfony\Component\DomCrawler\Tests\Field\ChoiceFormFieldTest::createSelectNode()
7 calls to ChoiceFormFieldTest::createSelectNode()
- ChoiceFormFieldTest::testDisableValidation in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php - ChoiceFormFieldTest::testMultipleSelects in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php - ChoiceFormFieldTest::testSelect in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php - ChoiceFormFieldTest::testSelects in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php - ChoiceFormFieldTest::testSelectWithEmptyBooleanAttribute in vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php
File
- vendor/
symfony/ dom-crawler/ Tests/ Field/ ChoiceFormFieldTest.php, line 346
Class
Namespace
Symfony\Component\DomCrawler\Tests\FieldCode
protected function createSelectNode($options, $attributes = array(), $selectedAttrText = 'selected') {
$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);
$option
->setAttribute('value', $value);
if ($selected) {
$option
->setAttribute('selected', $selectedAttrText);
}
$node
->appendChild($option);
}
return $node;
}