/** * Tests InputAtomConverter->convertPeople() */ public function testConvertPeople() { $this->setExpectedException(Exception); $this->InputAtomConverter->convertPeople(''); }
private function decodeRequests($requestParam, $requestType, $format = 'json') { if (empty($requestParam)) { return null; } switch ($format) { case 'json': $inputConverter = new InputJsonConverter(); break; case 'atom': $inputConverter = new InputAtomConverter(); break; default: throw new Exception("Invalid or unsupported input format"); break; } switch ($requestType) { case 'people': $ret = $inputConverter->convertPeople($requestParam); break; case 'activities': $ret = $inputConverter->convertActivities($requestParam); break; case 'messages': $ret = $inputConverter->convertMessages($requestParam); break; case 'appdata': $ret = $inputConverter->convertAppData($requestParam); break; case 'jsonbatch': // this type is only used by the internal json batch format if ($format != 'json') { throw new Exception("the json batch only supports the json input format"); } $ret = $inputConverter->convertJsonBatch($requestParam); break; //TODO add 'groups' and 'messages' here //TODO add 'groups' and 'messages' here default: throw new Exception("Unsupported REST call"); break; } return $ret; }