You are here

function RulesLinkTestCase::testConfirmLink in Rules Link 7.2

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

Test creating a new confirmation link.

File

./rules_link.test, line 85
Views integration.

Class

RulesLinkTestCase
Test class for Rules link.

Code

function testConfirmLink() {
  $name = 'test_rules_link';
  $this
    ->createLink($name, 'confirm');
  $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();
  $user2 = $this
    ->drupalCreateUser(array(
    "access rules link {$name}",
  ));
  $this
    ->drupalLogin($user2);
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'foo',
    'type' => 'article',
  ));
  $this
    ->drupalGet('node/' . $node->vid);
  $this
    ->clickLink($name);
  $this
    ->drupalPost('test_rules_link/1', array(), t('Confirm'));
  $this
    ->assertText('Rules link executed.', 'Confirm form was generated and rules link was executed.');
  $this
    ->drupalLogout();
}