You are here

public function ServicesParserTests::setUp in Services 6.3

Same name and namespace in other branches
  1. 7.3 tests/functional/ServicesParserTests.test \ServicesParserTests::setUp()

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

tests/functional/ServicesParserTests.test, line 24
Call the endpoint tests when no authentication is being used.

Class

ServicesParserTests

Code

public function setUp() {
  parent::setUp('autoload', 'ctools', 'services', 'rest_server');

  // Set up endpoint with disabled 'application/x-www-form-urlencoded' parser.
  $edit = $this
    ->populateEndpointFAPI();
  $endpoint = new stdClass();
  $endpoint->disabled = FALSE;
  $endpoint->api_version = 3;
  $endpoint->name = $edit['name'];
  $endpoint->title = $edit['title'];
  $endpoint->server = $edit['server'];
  $endpoint->path = $edit['path'];
  $endpoint->authentication = array(
    'services' => 'services',
  );
  $endpoint->server_settings = array(
    'rest_server' => array(
      'formatters' => array(
        'php' => TRUE,
      ),
      'parsers' => array(
        'application/x-yaml' => TRUE,
        'application/json' => TRUE,
        'application/vnd.php.serialized' => TRUE,
        'application/plist' => TRUE,
        'application/plist+xml' => TRUE,
        'application/x-www-form-urlencoded' => FALSE,
      ),
    ),
  );
  $endpoint->resources = array(
    'user' => array(
      'actions' => array(
        'login' => array(
          'enabled' => 1,
        ),
        'logout' => array(
          'enabled' => 1,
        ),
      ),
    ),
  );
  $endpoint->debug = 1;
  $endpoint->export_type = FALSE;
  services_endpoint_save($endpoint);
  $endpoint = services_endpoint_load($endpoint->name);
  $this
    ->assertTrue($endpoint->name == $edit['name'], t('Endpoint successfully created'));
  $this->endpoint = $endpoint;
}