You are here

function RulesLinkTestCase::createLink in Rules Link 7

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

Create a link with the given name and the type.

2 calls to RulesLinkTestCase::createLink()
RulesLinkTestCase::testConfirmLink in ./rules_link.test
Test creating a new confirmation link.
RulesLinkTestCase::testTokenLink in ./rules_link.test
Test creating a new token link.

File

./rules_link.test, line 30
Views integration.

Class

RulesLinkTestCase
Test class for Rules link.

Code

function createLink($name, $type) {
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalGet('admin/config/workflow/rules_links/add');
  $this
    ->assertText('Add rules link');
  $data = array(
    'label' => $name,
    'name' => $name,
    'entity_type' => 'node',
    'bundles[]' => array(
      'article',
    ),
    'text' => $name,
    'link_type' => $type,
    'question' => 'foo?',
    'description' => 'bar!',
    'entity_link' => TRUE,
  );
  $this
    ->drupalPost('admin/config/workflow/rules_links/add', $data, t('Continue'));
  $this
    ->assertText('Your Rules Link has been created along with the required components.');
  $this
    ->drupalGet('admin/people/permissions');
  $this
    ->assertText("{$name}: Execute rules link", 'Permission was created.');

  //$this->drupalLogout();

  // The Simpletest function checkPermissions() saves all permissions into a
  // static array, but rules links generates new permissions, when creating
  // a link. So we have to reset the static cache, so that the
  // checkPermissions function recognizes the new permissions.
  drupal_static_reset('checkPermissions');
}