function SimpleAccessOwnerTestCase::testSimpleAccessOwnerCanEdit in Simple Access 6.2
Same name and namespace in other branches
- 8.3 simple_access.test \SimpleAccessOwnerTestCase::testSimpleAccessOwnerCanEdit()
- 7.2 simple_access.test \SimpleAccessOwnerTestCase::testSimpleAccessOwnerCanEdit()
File
- ./
simple_access.test, line 29 - Tests to check that simple access is working correctly
Class
- SimpleAccessOwnerTestCase
- Test Owner permissions
Code
function testSimpleAccessOwnerCanEdit() {
$account = $this
->drupalCreateUser();
$n1 = $this
->drupalCreateNode(array(
'type' => $this->node_type,
'uid' => $account->uid,
'status' => 1,
'simple_access_owner' => array(
'sa_view' => 1,
),
));
$n2 = $this
->drupalCreateNode(array(
'type' => $this->node_type,
'uid' => $account->uid,
'status' => 1,
'simple_access_owner' => array(
'sa_view' => 1,
'sa_update' => 1,
),
));
$n1 = node_load($n1->nid);
$n1->status = 1;
$this
->assertFalse(node_access('update', $n1, $account), t('Owner doesn\'t have edit access to content'), 'Access');
$n2 = node_load($n2->nid);
$n2->status = 1;
$this
->assertTrue(node_access('update', $n2, $account), t('Owner has edit access to content'), 'Access');
}