function UserRelationshipsNodeAccessTestCase::testUserRelationshipsNodeAccessView in User Relationships 6
File
- user_relationship_node_access/
tests/ user_relationship_node_access.test, line 167 - User Relationships Node Access Tests
Class
- UserRelationshipsNodeAccessTestCase
- @file User Relationships Node Access Tests
Code
function testUserRelationshipsNodeAccessView() {
$this
->drupalLogin($this->users['u4']);
$node = array();
$node['title'] = $this
->randomName(8);
$node['body'] = $this
->randomName(16);
$node['user_relationship_node_access[view][1_ty]'] = TRUE;
$node['user_relationship_node_access[view][2]'] = TRUE;
$this
->drupalPost('node/add/page', $node, t('Save'));
$this
->assertTrue(preg_match('|node/(\\d+)$|', $this
->getUrl(), $matches), 'Node created');
$this
->drupalLogout();
// Can related user view?
$this
->drupalLogin($this->users['u1']);
$this
->drupalGet("node/{$matches[1]}");
$this
->assertResponse(200, 'Can view node.');
$this
->drupalLogout();
// Can unrelated user view?
$this
->drupalLogin($this->users['u5']);
$this
->drupalGet("node/{$matches[1]}");
$this
->assertResponse(403, 'Outside user cannot view node.');
$this
->drupalLogout();
}