public function testColumnDescriptionCustomProperties() { $cd = new ColumnDescription('first', ValueType::STRING); $cd->setCustomProperty('a', 'foo'); $properties = $cd->getCustomProperties(); $this->assertTrue(is_array($properties), "properties must be an array"); $this->assertArrayHasKey('a', $properties, "properties[a] must exist"); $this->assertSame('foo', $cd->getCustomProperty('a'), "getCustomProperty must return expected value"); }
/** * @param ColumnDescription $column * @return string */ public function renderColumnDescriptionJson(ColumnDescription $column) { $output = "{"; $output .= "\"id\":" . json_encode($column->getId()); $output .= ",\"label\":" . json_encode($column->getLabel()); $output .= ",\"type\":" . json_encode($column->getType()->getTypeName()); $output .= ",\"pattern\":" . json_encode($column->getPattern()); $customProperties = $this->renderCustomPropertiesString($column->getCustomProperties()); if ($customProperties !== null) { $output .= ",\"p\":" . $customProperties; } $output .= "}"; return $output; }