public function testSetIdsSetsIdsPropertyToGivenValue() { $ids = array('foo', 'bar'); $failedToDeleteData = new FailedToDeleteData(); $failedToDeleteData->setIds($ids); $this->assertAttributeSame($ids, 'ids', $failedToDeleteData); return $failedToDeleteData; }
public function testConvertFailedToDeleteConvertsArrayToFailedToDeleteObject() { $ids = array('foo', 'bar'); $failedToDelete = $this->jsonConverter->convertFailedToDelete(array(JSONConstants::JSON_FAILEDTODELETE_ID => $ids, 'customExtension' => 'foobar')); $expectedObject = new FailedToDeleteData(); $expectedObject->setIds($ids); $expectedObject->setExtensions(array(new CmisExtensionElement('', 'customExtension', array(), 'foobar'))); $this->assertEquals($expectedObject, $failedToDelete); }
/** * Converts FailedToDelete ids. * * @param array|null $data * @return FailedToDeleteData */ public function convertFailedToDelete(array $data = null) { $result = new FailedToDeleteData(); if (empty($data)) { return $result; } $jsonIds = array(); if (isset($data[JSONConstants::JSON_FAILEDTODELETE_ID])) { $jsonIds = (array) $data[JSONConstants::JSON_FAILEDTODELETE_ID]; } $ids = array(); foreach ($jsonIds as $id) { $ids[] = (string) $id; } $result->setIds($ids); $result->setExtensions($this->convertExtension($data, JSONConstants::getFailedToDeleteKeys())); return $result; }