You are here

function WSClientSOAPRulesTestCase::testRulesIntegration in Web service client 7

Tests invoking the geocoder.us service.

File

wsclient_examples/wsclient_examples.test, line 50
Web service client SOAP/REST Tests.

Class

WSClientSOAPRulesTestCase

Code

function testRulesIntegration() {
  list($result) = rules_action('wsclient_geocoder_geocode_address', array())
    ->execute('1600 Pennsylvania Av, Washington, DC');
  $this
    ->assertEqual($result[0]->zip, '20502', 'SOAP service invoked via the action.');
  $rule = rule(array(
    'address' => array(
      'type' => 'text',
    ),
  ));
  $rule
    ->action('wsclient_geocoder_geocode_address', array(
    'param_address:select' => 'address',
  ))
    ->action('drupal_message', array(
    'message:select' => 'result:0:zip',
  ))
    ->execute('1600 Pennsylvania Av, Washington, DC');
  RulesLog::logger()
    ->checkLog();
  $msg = drupal_get_messages();
  $this
    ->assertEqual(array_pop($msg['status']), '20502', 'SOAP service has been invoked.');
}