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 renderDependencyContent(DropDownDependencyCustomFieldMapping $mapping, $parentMapping, $totalPositions) { assert('$parentMapping instanceof DropDownDependencyCustomFieldMapping || $parentMapping == null'); $content = '<table width="' . round(100 / $totalPositions, 2) . '%">'; $content .= '<tr>'; $content .= '<td>'; $content .= $mapping->getTitle(); $content .= '</td>'; $content .= '</tr>'; $content .= '<tr>'; $content .= '<td>'; $content .= $this->renderAttributeNameSelectionContent($mapping); $content .= '</td>'; $content .= '</tr>'; $content .= '<tr>'; $content .= '<td>'; if ($mapping->getAttributeName() != null && $mapping->getPosition() > 0) { $content .= $this->renderValuesToParentValuesContent($mapping, $parentMapping); } else { $content .= ' '; } $content .= '</td>'; $content .= '</tr>'; $content .= '</table>'; return $content; }