You are here

public function UuidFileServicesTest::saveNewEndpoint in Universally Unique IDentifier 7

Overrides ServicesWebTestCase::saveNewEndpoint

1 call to UuidFileServicesTest::saveNewEndpoint()
UuidFileServicesTest::setUp in uuid_services/uuid_services.file_services.test
Implementation of setUp().

File

uuid_services/uuid_services.file_services.test, line 50
Test the UUID File Services integration.

Class

UuidFileServicesTest
Test the UUID File Services integration.

Code

public function saveNewEndpoint() {
  $edit = $this
    ->populateEndpointFAPI();
  $endpoint = new stdClass();
  $endpoint->disabled = FALSE;
  $endpoint->api_version = 3;
  $endpoint->name = $edit['name'];
  $endpoint->server = $edit['server'];
  $endpoint->path = $edit['path'];
  $endpoint->authentication = array(
    'services' => 'services',
  );
  $endpoint->server_settings = array(
    'formatters' => array(
      'json' => TRUE,
      'bencode' => TRUE,
      'rss' => TRUE,
      'plist' => TRUE,
      'xmlplist' => TRUE,
      'php' => TRUE,
      'yaml' => TRUE,
      'jsonp' => FALSE,
      'xml' => FALSE,
    ),
    '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' => TRUE,
      'multipart/form-data' => TRUE,
    ),
  );
  $endpoint->resources = array(
    'file' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => '1',
        ),
        'delete' => array(
          'enabled' => '1',
        ),
        'index' => array(
          'enabled' => '1',
        ),
        'update' => array(
          'enabled' => '1',
        ),
      ),
      'actions' => array(
        'create_raw' => 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'], 'Endpoint successfully created');
  return $endpoint;
}