public function testDescription() { $this->assertEquals('', $this->attributeMetadata->getDescription()); $newAttributeMetadata = $this->attributeMetadata->withDescription('desc'); $this->assertEquals('desc', $newAttributeMetadata->getDescription()); $this->assertNotEquals($this->attributeMetadata, $newAttributeMetadata); }
/** * @param AttributeMetadata $attribute * @param $entityName * @param $type * @return array|null|string */ protected function addAttribute(AttributeMetadata $attribute, $entityName, $type) { if ($type === 'context') { if (!($id = $attribute->getIri())) { $prefixedShortName = sprintf('#%s', $entityName); $id = sprintf('%s/%s', $prefixedShortName, $attribute->getName()); } return $id; } $propertyInfo = array_shift($attribute->getTypes()); $type = $propertyInfo->getType(); return ['dataType' => $type, 'actualType' => $type, 'subType' => null, 'required' => $attribute->isRequired(), 'default' => null, 'description' => $attribute->getDescription(), 'readonly' => !$attribute->isWritable(), 'sinceVersion' => null, 'untilVersion' => null]; }