You are here

function RulesLinkTestCase::testTokenLink in Rules Link 7.2

Same name and namespace in other branches
  1. 7 rules_link.test \RulesLinkTestCase::testTokenLink()

Test creating a new token link.

File

./rules_link.test, line 63
Views integration.

Class

RulesLinkTestCase
Test class for Rules link.

Code

function testTokenLink() {
  $name = 'token_link';
  $this
    ->createLink($name, 'token');
  $rules_link = rules_link_load($name);
  $set = rules_config_load(rules_link_get_rules_set_name($rules_link));
  $set
    ->rule(rule()
    ->action('drupal_message', array(
    'message' => 'Rules link executed.',
  )));
  $set
    ->save();
  $tokenUser = $this
    ->drupalCreateUser(array(
    "access rules link {$name}",
    'administer rules',
  ));
  $this
    ->drupalLogin($tokenUser);
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'foo',
    'type' => 'article',
  ));
  $this
    ->drupalGet('node/' . $node->vid);
  $this
    ->clickLink($name);
  $this
    ->assertText('Rules link executed');

  //*/
}