'Soap Server', 'description' => 'Verify Soap server implementation.', 'group' => 'Services', 'dependencies' ); } function setUp(){ // Enable soap_server should enable also services. parent::setUp(array('ctools', 'services', 'soap_server')); // Login as services administrator. $user = $this->drupalCreateUser(array('administer services')); $this->drupalLogin($user); // Create a SOAP endpoint. $this->endpoint = array( 'name' => 'soap_server_test_endpoint', 'title' => $this->randomName(), 'server' => 'soap_server', 'path' => 'services/soap/simpletest', 'services_use_content_permissions' => TRUE, ); $this->drupalPost( 'admin/build/services/add', $this->endpoint, t('Save and proceed') ); $this->assertRaw(t('Your new endpoint %title has been saved.', array('%title' => $this->endpoint['title']))); // Enable system resources $resources = array( 'resources[system][actions][connect][enabled]' => TRUE, 'resources[system][actions][get_variable][enabled]' => TRUE, 'resources[system][actions][set_variable][enabled]' => TRUE, ); $this->drupalPost( 'admin/build/services/' . $this->endpoint['name'] . '/resources', $resources, t('Save') ); $this->assertRaw(t('Your resources have been saved.')); } /** * Verify WSDL generation. */ // function testWSDLGeneration() { // } /** * Verify SOAP server handler. */ function testSOAPHandler() { $wsdl_url = url($this->endpoint['path'], array('absolute' => TRUE)) . '?wsdl'; // exceptions will not work in this context. $options = array('trace' => 1, 'exceptions' => TRUE); if (preg_match('/simpletest\d+/', $this->databasePrefix, $matches)) { $options += array('user_agent' => drupal_generate_test_ua($matches[0])); } $client = new SoapClient($wsdl_url, $options); $result = $client->__getFunctions(); if (is_soap_fault($result)) { $this->fail('Return service available functions.'); } else { $this->assertTrue(strstr($result[0], 'system_connect') , t('System connect method found.')); $this->assertTrue(strstr($result[1], 'system_get_variable') , t('System get_variable method found.')); $this->assertTrue(strstr($result[2], 'system_set_variable') , t('System set_variable method found.')); } } }