public function testConvertRepositoryCapabilitiesConvertsArrayToRepositoryCapabilitiesObject() { $expectedCapabilities = new RepositoryCapabilities(); $expectedCapabilities->setSupportsUnfiling(true); $expectedCapabilities->setSupportsPwcUpdatable(true); $expectedCapabilities->setSupportsMultifiling(true); $expectedCapabilities->setSupportsGetFolderTree(true); $expectedCapabilities->setSupportsGetDescendants(true); $expectedCapabilities->setAclCapability(CapabilityAcl::cast(CapabilityAcl::MANAGE)); $expectedCapabilities->setChangesCapability(CapabilityChanges::cast(CapabilityChanges::PROPERTIES)); $expectedCapabilities->setContentStreamUpdatesCapability(CapabilityContentStreamUpdates::cast(CapabilityContentStreamUpdates::ANYTIME)); $creatablePropertyTypes = new CreatablePropertyTypes(); $creatablePropertyTypes->setCanCreate(array(PropertyType::cast(PropertyType::DATETIME), PropertyType::cast(PropertyType::ID), PropertyType::cast(PropertyType::HTML))); $creatablePropertyTypes->setExtensions($this->cmisExtensionsDummy); $expectedCapabilities->setCreatablePropertyTypes($creatablePropertyTypes); $expectedCapabilities->setQueryCapability(CapabilityQuery::cast(CapabilityQuery::BOTHCOMBINED)); $newTypeSettableAttributes = new NewTypeSettableAttributes(); $newTypeSettableAttributes->setCanSetId(true); $newTypeSettableAttributes->setExtensions($this->cmisExtensionsDummy); $expectedCapabilities->setNewTypeSettableAttributes($newTypeSettableAttributes); $expectedCapabilities->setJoinCapability(CapabilityJoin::cast(CapabilityJoin::NONE)); $expectedCapabilities->setRenditionsCapability(CapabilityRenditions::cast(CapabilityRenditions::NONE)); $expectedCapabilities->setOrderByCapability(CapabilityOrderBy::cast(CapabilityOrderBy::NONE)); $expectedCapabilities->setExtensions($this->cmisExtensionsDummy); $repositoryInfoArray = current($this->getResponseFixtureContentAsArray('Cmis/v1.1/BrowserBinding/getRepositoryInfo-full-response.log')); $result = $this->jsonConverter->convertRepositoryCapabilities($repositoryInfoArray[JSONConstants::JSON_REPINFO_CAPABILITIES]); $this->assertEquals($expectedCapabilities, $result); return $result; }
/** * Create CreatablePropertyTypes object and populate given data to it * * @param array|null $data The data that should be populated to the CreatablePropertyTypes object * @return CreatablePropertyTypes|null Returns a CreatablePropertyTypes object or <code>null</code> if empty data * is given. */ public function convertCreatablePropertyTypes(array $data = null) { if (empty($data)) { return null; } $object = new CreatablePropertyTypes(); if (isset($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE]) && is_array($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE])) { $canCreate = array(); foreach ($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE] as $canCreateItem) { try { $canCreate[] = PropertyType::cast($canCreateItem); } catch (InvalidEnumerationValueException $exception) { // ignore invalid types } } $object->setCanCreate($canCreate); } $object->setExtensions($this->convertExtension($data, JSONConstants::getCapabilityCreatablePropertyKeys())); return $object; }