function FlagAccessLinkTestCase::testFlagAccessFlagUnflag in Flag 7.3
Test that a user with flag access can flag and unflag.
File
- tests/
flag.test, line 744 - Tests for the Flag module.
Class
- FlagAccessLinkTestCase
- Access to flags using the basic flag link.
Code
function testFlagAccessFlagUnflag() {
// Create test user who can flag and unflag.
$flag_unflag_user = $this
->drupalCreateUser(array(
'flag test_flag',
'unflag test_flag',
));
$this
->drupalLogin($flag_unflag_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.');
}