public function testGetSetAndMethods() { $availableCustomFieldAttributes = array('a', 'test', 'b'); $mappingData = array('Item 1' => 'parentItem1', 'Item2' => null); $customFieldData = CustomFieldData::getByName('Items'); $mapping = new DropDownDependencyCustomFieldMapping(3, 'test', $availableCustomFieldAttributes, $customFieldData, $mappingData); $this->assertEquals(true, $mapping->allowsAttributeSelection()); $mapping->doNotAllowAttributeSelection(); $this->assertEquals(false, $mapping->allowsAttributeSelection()); $this->assertEquals('Level: 4', $mapping->getTitle()); $this->assertEquals(3, $mapping->getPosition()); $this->assertEquals('test', $mapping->getAttributeName()); $this->assertEquals($availableCustomFieldAttributes, $mapping->getAvailableCustomFieldAttributes()); $this->assertEquals('First select level 3', $mapping->getSelectHigherLevelFirstMessage()); $this->assertEquals($customFieldData, $mapping->getCustomFieldData()); $this->assertEquals('parentItem1', $mapping->getMappingDataSelectedParentValueByValue('Item 1')); $this->assertEquals(null, $mapping->getMappingDataSelectedParentValueByValue('Item 2')); }
protected function renderValuesToParentValuesMappingDropDownContent(DropDownDependencyCustomFieldMapping $parentMapping, $position, $value, $valuePosition, $selectedParentValue) { assert('is_int($position)'); assert('is_string($value)'); assert('is_int($valuePosition)'); assert('is_string($selectedParentValue) || $selectedParentValue == null'); $inputName = $this->formName . '[mappingData][' . $position . '][valuesToParentValues][' . $value . ']'; $inputId = $this->formName . '_mappingData_' . $position . '_valuesToParentValues_' . $valuePosition; $htmlOptions = array(); $htmlOptions['id'] = $inputId; $htmlOptions['empty'] = Zurmo::t('Core', '(None)'); $dataAndLabels = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($parentMapping->getCustomFieldData(), Yii::app()->language); $content = ZurmoHtml::dropDownList($inputName, $selectedParentValue, $dataAndLabels, $htmlOptions); return $content; }