MDL-85565 phpunit: check for <select> before <option>
Make sure that assert_select_options() will fail when the output does not contain a <select> and therefore does not have the given options.
This commit is contained in:
@@ -574,6 +574,7 @@ abstract class question_testcase extends advanced_testcase {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadHTML($html);
|
||||
$selects = $dom->getElementsByTagName('select');
|
||||
$this->assertGreaterThanOrEqual(1, $selects->count(), 'There is no <select> in the output.');
|
||||
foreach ($selects as $select) {
|
||||
if ($select->getAttribute('name') == $expectation->name) {
|
||||
$options = $select->getElementsByTagName('option');
|
||||
|
||||
Reference in New Issue
Block a user