Example #1
0
 public function testGetHtml()
 {
     $selectId = 'testId';
     $selectClass = 'testClass';
     $selectTitle = 'testTitle';
     $selectName = 'testName';
     $value = 'testValue';
     $label = 'testLabel';
     $params = ['paramKey' => 'paramValue'];
     $valueGroup = ['groupElementValue' => 'GroupElementLabel', 'selectedGroupElementValue' => 'SelectedGroupElementLabel'];
     $labelGroup = 'groupLabel';
     $selectedValue = 'selectedValue';
     $selectedLabel = 'selectedLabel';
     $selectedParams = [['paramKey' => 'paramValue', 'paramKey2' => 'paramValue2']];
     $selectedValues = [$selectedValue, 'selectedGroupElementValue'];
     $this->select->setId($selectId);
     $this->select->setClass($selectClass);
     $this->select->setTitle($selectTitle);
     $this->select->setName($selectName);
     $this->select->addOption($value, $label, $params);
     $this->select->addOption($selectedValue, $selectedLabel, $selectedParams);
     $this->select->addOption($valueGroup, $labelGroup);
     $this->select->setValue($selectedValues);
     $result = '<select name="testName" id="testId" class="testClass" title="testTitle" >' . '<option value="testValue"  paramKey="paramValue" >testLabel</option>' . '<option value="selectedValue" selected="selected"  paramKey="paramValue" ' . ' paramKey2="paramValue2" >selectedLabel</option>' . '<optgroup label="groupLabel">' . '<option value="groupElementValue" >GroupElementLabel</option>' . '<option value="selectedGroupElementValue" selected="selected" >SelectedGroupElementLabel</option>' . '</optgroup>' . '</select>';
     $this->assertEquals($result, $this->select->getHtml());
 }