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 renderValuesToParentValuesContent(DropDownDependencyCustomFieldMapping $mapping, DropDownDependencyCustomFieldMapping $parentMapping)
 {
     assert('is_string($mapping->getAttributeName()) && $mapping->getPosition() > 0');
     $dataAndLabels = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($mapping->getCustomFieldData(), Yii::app()->language);
     $content = '<table>';
     $valuePosition = 0;
     foreach ($dataAndLabels as $value => $label) {
         $content .= '<tr>';
         $content .= '<td>';
         $content .= Zurmo::t('DesignerModule', 'Display {label} when', array('{label}' => $label));
         $content .= '</td>';
         $content .= '</tr><tr>';
         $content .= '<td>';
         $content .= $this->renderValuesToParentValuesMappingDropDownContent($parentMapping, $mapping->getPosition(), $value, $valuePosition, $mapping->getMappingDataSelectedParentValueByValue($value));
         $content .= '</td>';
         $content .= '</tr>';
         $valuePosition++;
     }
     $content .= '</table>';
     return $content;
 }