public function ServicesWebTestCase::saveNewVersionEndpoint in Services 7.3
2 calls to ServicesWebTestCase::saveNewVersionEndpoint()
- ServicesResourceUsertests::testUserLoginMethodAPI_1_1 in tests/
functional/ ServicesResourceUserTests.test - Test login method. API VERsion 1.1
- ServicesVersionTests::testVersion in tests/
functional/ ServicesVersionTests.test - Test connect method.
File
- tests/
services.test, line 530
Class
Code
public function saveNewVersionEndpoint($version = '1.0') {
$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' => array(),
);
$endpoint->server_settings = array(
'formatters' => array(
'bencode' => TRUE,
'json' => TRUE,
'php' => TRUE,
'plist' => TRUE,
'rss' => TRUE,
'xml' => TRUE,
'xmlplist' => TRUE,
'jsonp' => FALSE,
),
'parsers' => array(
'application/json' => TRUE,
'application/plist' => TRUE,
'application/plist+xml' => TRUE,
'application/vnd.php.serialized' => TRUE,
'multipart/form-data' => TRUE,
'application/x-www-form-urlencoded' => 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',
),
),
),
'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',
'settings' => array(
'services' => array(
'resource_api_version' => $version,
),
),
),
'logout' => array(
'enabled' => '1',
),
'register' => array(
'enabled' => '1',
),
),
'targeted_actions' => array(
'cancel' => array(
'enabled' => 1,
),
'password_reset' => array(
'enabled' => 1,
),
'resend_welcome_email' => array(
'enabled' => 1,
),
),
),
'services_test' => array(
'operations' => array(
'retrieve' => array(
'enabled' => '1',
'settings' => array(
'services' => array(
'resource_api_version' => $version,
),
),
),
),
),
'views' => array(
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
),
),
);
$endpoint->debug = 0;
$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;
}