You are here

function FlagHookFlagAccessTestCase::testFlagAccessIgnore in Flag 7.3

Verifies that the user sees the flag if a module returns NULL (Ignore).

File

tests/flag.test, line 984
Tests for the Flag module.

Class

FlagHookFlagAccessTestCase
Verifies the implementation of hook_flag_access().

Code

function testFlagAccessIgnore() {
  variable_set('FlagHookFlagAccessTestCaseMode', 'ignore');
  $flag_user = $this
    ->drupalCreateUser(array(
    'flag test_flag',
    'unflag test_flag',
  ));
  $this
    ->drupalLogin($flag_user);

  // Look at our node.
  $this
    ->drupalGet('node/' . $this->nid);
  $this
    ->assertLink('Flag this item', 0, 'The flag link appears on the page.');

  // Click the link to flag the node.
  $this
    ->clickLink(t('Flag this item'));
  $this
    ->assertLink('Unflag this item', 0, 'The unflag link appears on the page after flagging.');

  // Click the link to unflag the node.
  $this
    ->clickLink(t('Unflag this item'));
  $this
    ->assertLink('Flag this item', 0, 'The flag link appears on the page after unflagging.');
}