You are here

function FlagAccessLinkTestCase::testFlagAccessFlagOnly in Flag 7.3

Test that a user with only flag access can flag but not unflag.

File

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

Class

FlagAccessLinkTestCase
Access to flags using the basic flag link.

Code

function testFlagAccessFlagOnly() {

  // Create test user who can flag but not unflag.
  $flag_user = $this
    ->drupalCreateUser(array(
    'flag 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
    ->assertText('You may not unflag this item', 0, 'The unflag denied text appears on the page after flagging.');
}