function OgAccessTestCase::testGroupContentAccessNotExist in Organic groups 7.2
Test group content without access field.
File
- og_access/
og_access.test, line 245 - Test organic groups access module.
Class
- OgAccessTestCase
- Test OG access.
Code
function testGroupContentAccessNotExist() {
$this
->drupalLogin($this->user1);
$nid = $this->group_node->nid;
// Create a group content node and set default access.
$settings = array();
$settings['type'] = $this->group_content_type;
$settings[OG_AUDIENCE_FIELD][LANGUAGE_NONE][0]['target_id'] = $nid;
$group_content_node = $this
->drupalCreateNode($settings);
// Assert the user can view the group.
// Assert the user is a group member.
$this
->assertTrue(og_is_member('node', $nid, 'user', $this->user1), t('User is a group member.'));
$this
->drupalGet('node/' . $group_content_node->nid);
$this
->assertResponse('200', t('Group member can view group node.'));
// Assert another user is not a group member.
$this
->drupalLogin($this->user2);
$this
->assertFalse(og_is_member('node', $nid, 'user', $this->user2), t('User is not a group member.'));
// Assert non-member can't view the group.
$this
->drupalGet('node/' . $group_content_node->nid);
$this
->assertResponse('403', t('Non group member can not view group node.'));
}