You are here

function NofollowListTestCase::setupNofollowlist in Nofollow List 7

Sets up nofollowlist basic configuration.

Enables nofollowlist filter for the full html text format and configures either whitelist of blacklist mode.

Parameters

string $mode: The nofollowlist mode. Can be 'white' for whitelist or 'black' for blacklist.

string $hosts: List of domains to use in blacklist or whitelist mode.

2 calls to NofollowListTestCase::setupNofollowlist()
NofollowListTestCase::testNoRelFollowOnBlacklist in ./nofollowlist.test
Tests blacklist functionality.
NofollowListTestCase::testNoRelFollowOnWhitelist in ./nofollowlist.test
Tests whitelist functionality.

File

./nofollowlist.test, line 37
Tests for nofollowlist.module.

Class

NofollowListTestCase
Tests the rel="nofollow" whitelist functionality.

Code

function setupNofollowlist($mode, $hosts) {

  // Create an admin user.
  $admin = $this
    ->drupalCreateUser(array(
    'administer filters',
    'administer nodes',
    'bypass node access',
    'edit any page content',
    'use text format full_html',
  ));
  $this
    ->drupalLogin($admin);

  // Configure whitelist.
  // Go to full html text format configuration page.
  $this
    ->drupalGet('admin/config/content/formats/full_html');

  // Enable nofollow filter.
  $edit['filters[filter_nofollow][status]'] = 1;
  $this
    ->drupalPost('admin/config/content/formats/full_html', $edit, t('Save configuration'));

  // Go to full html text format configuration page.
  $this
    ->drupalGet('admin/config/content/formats/full_html');

  // Set to whitelist.
  $edit['filters[filter_nofollow][settings][nofollowlist_option]'] = $mode;
  $edit['filters[filter_nofollow][settings][nofollowlist_hosts]'] = $hosts;
  $this
    ->drupalPost('admin/config/content/formats/full_html', $edit, t('Save configuration'));
}