You are here

class MockRESTServer in Services 7.3

Extend RESTServer to test protected methods.

Hierarchy

Expanded class hierarchy of MockRESTServer

File

servers/rest_server/tests/rest_server_mock_classes.inc, line 54

View source
class MockRESTServer extends RESTServer {
  public function protectedGetControllerArgumentsFromSources($controller, $sources) {
    return $this
      ->getControllerArgumentsFromSources($controller, $sources);
  }
  public function protectedRender($formatter, $result) {
    return $this
      ->render($formatter, $result);
  }
  public function protectedGetResourceName() {
    return $this
      ->getResourceName();
  }
  public function protectedGetResponseFormatter() {
    return $this
      ->getResponseFormatter();
  }
  public function protectedResolveController($resource, &$operation) {
    return $this
      ->resolveController($resource, $operation);
  }
  public function protectedParseRequestBody() {
    return $this
      ->parseRequestBody();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MockRESTServer::protectedGetControllerArgumentsFromSources public function
MockRESTServer::protectedGetResourceName public function
MockRESTServer::protectedGetResponseFormatter public function
MockRESTServer::protectedParseRequestBody public function
MockRESTServer::protectedRender public function
MockRESTServer::protectedResolveController public function
RESTServer::$context protected property
RESTServer::$controller protected property
RESTServer::$formatters protected property
RESTServer::$negotiator protected property
RESTServer::$parsers protected property
RESTServer::$resources protected property
RESTServer::checkNumberOfArguments protected function Count possible numbers of 'path' arguments of the method.
RESTServer::formatHttpHeaderStatusMessage protected function Formats a status code and message for use as an HTTP header message.
RESTServer::getCanonicalPath public function Canonical path is the url of the request without path of endpoint.
RESTServer::getCanonicalPathArray protected function Explode canonical path to parts by '/'.
RESTServer::getController protected function Controller is part of the resource like
RESTServer::getControllerArguments protected function Parses controller arguments from request
RESTServer::getControllerArgumentsFromSources protected function array $controller Controller definition array $sources Array of sources for arguments. Consists of following elements: 'path' - path requested 'params' - GET variables 'data' - parsed POST data 'headers' -…
RESTServer::getRequestMethod protected function Determine the request method
RESTServer::getResourceName protected function Example. We have endpoint with path 'rest'. Request is done to url /rest/node/1.php'. Name of resource in this case is 'node'.
RESTServer::getResponseFormatContentTypeNegotiations protected function Determine response format and mime type using headers to negotiate content types.
RESTServer::getResponseFormatFromURL protected function Retrieve formatter from URL. If format is in the path, we remove it from $canonical_path.
RESTServer::getResponseFormatter protected function Response formatter is responsible for encoding the response.
RESTServer::handle public function Handles the call to the REST server
RESTServer::handleException public function Set proper header and message in case of exception.
RESTServer::matchParser protected function Matches a mime-type against a set of parsers.
RESTServer::parseContentHeader protected function Extract value of the header string.
RESTServer::parseRequestBody protected function Parse request body based on $_SERVER['CONTENT_TYPE'].s
RESTServer::parseRequestHeaders protected function
RESTServer::render protected function Render results using formatter.
RESTServer::resolveController protected function Determine controller.
RESTServer::resolveControllerApplyVersion protected function Wrapper around resolveController() to apply version.
RESTServer::uri_formatter public function Formats a resource uri
RESTServer::__construct function Constructor. Initialize properties.