You are here

class MockServicesRESTServerFactory in Services 7.3

Factory to build RESTServer object for testing.

Hierarchy

Expanded class hierarchy of MockServicesRESTServerFactory

File

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

View source
class MockServicesRESTServerFactory extends ServicesRESTServerFactory {
  static $class_name = 'MockRESTServer';
  public function __construct($data = array()) {
    parent::__construct($data);
    drupal_static_reset();
  }
  protected function getContext() {
    $context = new MockServicesContext($this->data['endpoint_path']);
    $context
      ->setData($this->data['context_data']);
    return $context;
  }
  protected function getResources() {
    if (isset($this->data['resources'])) {
      return $this->data['resources'];
    }
    return array();
  }
  protected function getFormatters() {
    if (isset($this->data['formatters'])) {
      return $this->data['formatters'];
    }
    return array();
  }
  protected function getParsers() {
    if (isset($this->data['parsers'])) {
      return $this->data['parsers'];
    }
    return array();
  }

}

Members