/** * Tests RestRequestItem->createRequestItem() */ public function testCreateRequestItem() { $url = '/people/@viewer/@self'; $method = 'GET'; $postData = array(); $postData['data'] = 'DataTest'; $params = array(); $params['param1'] = 'DataParam1'; $this->RestRequestItem->createRequestItem($url, $this->getToken(), $method, $params, $postData); $this->assertEquals($url, $this->RestRequestItem->getUrl()); $this->assertEquals($this->token, $this->RestRequestItem->getToken()); $this->assertEquals($method, $this->RestRequestItem->getMethod()); $this->assertEquals($params, $this->RestRequestItem->getParameters()); $this->assertEquals($postData, $this->RestRequestItem->getPostData()); }
private function handleRequest($token, $method) { $params = $this->getListParams(); $requestItem = new RestRequestItem(); $url = $this->getUrl(); $requestType = $this->getRouteFromParameter($url); $requestFormat = $this->getRequestFormat(); $requestParam = $this->getRequestParams($requestType, $requestFormat); $requestItem->createRequestItem($url, $token, $method, $params, $requestParam); $responseItem = $this->getResponseItem($requestItem); return array('request' => $requestItem, 'response' => $responseItem); }