Skip to content

Commit

Permalink
Updated to better handle permittedValues in <select> elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kschroeder committed May 25, 2017
1 parent d117cb5 commit de64aaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/View/Controllers/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function getSourceData(\SimpleXMLElement $node)
} else if (isset($node->permittedValues)) {
$source = [];
foreach ($node->permittedValues->children() as $value) {
$source[] = (string)$value;
$source[(string)$value] = (string)$value;
}
return $source;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/View/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function testViewRendering()
self::assertXpathExists($simpleXml, '//input[@type="text" and @name="section1_test_element"]'); // we do this separately to test if the element exists apart from whether it has a value.
self::assertXpathExists($simpleXml, '//input[@type="text" and @name="section1_test_element" and @value="Element Value"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="yes"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="no"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="yes" and @value="yes"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="no" and @value="no"]');
}

public function getViewConfiguration(array $params = [], $method = 'GET')
Expand Down

0 comments on commit de64aaf

Please sign in to comment.