You are here

public function ServicesWebTestCase::saveNewEndpoint in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesWebTestCase.php \ServicesWebTestCase::saveNewEndpoint()
8 calls to ServicesWebTestCase::saveNewEndpoint()
ServicesResourceCommentTests::setUp in tests/functional/ServicesResourceCommentTests.test
Sets up a Drupal site for running functional and integration tests.
ServicesResourceFileTests::setUp in tests/functional/ServicesResourceFileTests.test
Sets up a Drupal site for running functional and integration tests.
ServicesResourceNodeTaxonomytests::setUp in tests/functional/ServicesResourceNodeTests.test
Sets up a Drupal site for running functional and integration tests.
ServicesResourceNodetests::setUp in tests/functional/ServicesResourceNodeTests.test
Sets up a Drupal site for running functional and integration tests.
ServicesResourceSystemTests::setUp in tests/functional/ServicesResourceSystemTests.test
Sets up a Drupal site for running functional and integration tests.

... See full list

2 methods override ServicesWebTestCase::saveNewEndpoint()
ServicesArgumentsTestCase::saveNewEndpoint in tests/functional/ServicesArgumentsTests.test
ServicesResourceDisabledTest::saveNewEndpoint in tests/functional/ServicesResourceDisabledTests.test
Save a new endpoint without any resources enabled. This is a method from ServicesWebTestCase that has been modified.

File

tests/services.test, line 294

Class

ServicesWebTestCase

Code

public function saveNewEndpoint() {
  $edit = $this
    ->populateEndpointFAPI();
  $endpoint = new stdClass();
  $endpoint->disabled = FALSE;

  /* Edit this to true to make a default endpoint disabled initially */
  $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(
    'comment' => array(
      'operations' => array(
        'create' => array(
          'enabled' => 1,
        ),
        'retrieve' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'countAll' => array(
          'enabled' => 1,
        ),
        'countNew' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'file' => array(
      'operations' => array(
        'create' => array(
          'enabled' => 1,
        ),
        'retrieve' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'create_raw' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'node' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'relationships' => array(
        'files' => array(
          'enabled' => 1,
        ),
        'comments' => array(
          'enabled' => 1,
        ),
      ),
      'targeted_actions' => array(
        'attach_file' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'system' => array(
      'actions' => array(
        'connect' => array(
          'enabled' => 1,
        ),
        'get_variable' => array(
          'enabled' => 1,
        ),
        'set_variable' => array(
          'enabled' => 1,
        ),
        'del_variable' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'taxonomy_term' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'selectNodes' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'taxonomy_vocabulary' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'getTree' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'user' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
        'index' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'login' => array(
          'enabled' => 1,
        ),
        'logout' => array(
          'enabled' => '1',
          'settings' => array(
            'services' => array(
              'resource_api_version' => '1.1',
            ),
          ),
        ),
        'register' => array(
          'enabled' => 1,
        ),
        'request_new_password' => array(
          'enabled' => 1,
        ),
      ),
      'targeted_actions' => array(
        'cancel' => array(
          'enabled' => 1,
        ),
        'password_reset' => array(
          'enabled' => 1,
        ),
        'resend_welcome_email' => 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;
}