You are here

function WSClientRESTRulesTestCase::testRulesIntegration in Web service client 7

Tests invoking the google translation service.

File

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

Class

WSClientRESTRulesTestCase

Code

function testRulesIntegration() {
  list($result) = rules_action('wsclient_twitter_search_search', array(
    'param_q' => 'drupal',
  ))
    ->execute();
  $this
    ->assertEqual($result['query'], 'drupal', 'REST service invoked via the action.');

  // Test making use of the provided variable.
  $rule = rule(array(
    'text' => array(
      'type' => 'text',
    ),
  ));
  $rule
    ->action('wsclient_twitter_search_search', array(
    'param_q:select' => 'text',
  ))
    ->action('drupal_message', array(
    'message:select' => 'result:query',
  ))
    ->execute('drupal');
  RulesLog::logger()
    ->checkLog();
  $msg = drupal_get_messages();
  $this
    ->assertEqual(drupal_strtolower(array_pop($msg['status'])), 'drupal', 'REST service has been invoked.');
}