function FlagHookFlagAccessTestCase::testFlagAccessAllowOverride in Flag 7.3
Verifies that the user sees the flag if a module returns TRUE (Allow) to override default access check.
File
- tests/
flag.test, line 1033 - Tests for the Flag module.
Class
- FlagHookFlagAccessTestCase
- Verifies the implementation of hook_flag_access().
Code
function testFlagAccessAllowOverride() {
variable_set('FlagHookFlagAccessTestCaseMode', 'allow');
$flag_user = $this
->drupalCreateUser(array());
$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.');
}