function UserRelationshipsNodeAccessTestCase::testUserRelationshipsNodeAccessDelete in User Relationships 6
File
- user_relationship_node_access/
tests/ user_relationship_node_access.test, line 116 - User Relationships Node Access Tests
Class
- UserRelationshipsNodeAccessTestCase
- @file User Relationships Node Access Tests
Code
function testUserRelationshipsNodeAccessDelete() {
$this
->drupalLogin($this->users['u2']);
$node = array();
$node['title'] = $this
->randomName(8);
$node['body'] = $this
->randomName(16);
$node['user_relationship_node_access[delete][1_ty]'] = TRUE;
$node['user_relationship_node_access[delete][2]'] = TRUE;
$this
->drupalPost('node/add/page', $node, t('Save'));
$this
->assertTrue(preg_match('|node/(\\d+)$|', $this
->getUrl(), $matches), 'Node created');
$this
->drupalLogout();
// Can my relation delete after they log in?
$this
->drupalLogin($this->users['u1']);
$this
->drupalPost("node/{$matches[1]}/delete", null, t('Delete'));
$this
->drupalLogout();
// Can unrelated user delete?
$this
->drupalLogin($this->users['u5']);
$this
->drupalGet("node/{$matches[1]}/delete");
$this
->assertResponse(404, 'Outside user cannot delete.');
$this
->drupalLogout();
}