You are here

public function GNodeCreateAccessTests::testOutsiderCreateAccess in Group 7

Test outsider user's create access. This checks via several permissions: create node and administer group.

File

modules/gnode/tests/gnode.test, line 904
Tests for the gnode module.

Class

GNodeCreateAccessTests
Test for create access control.

Code

public function testOutsiderCreateAccess() {
  $group_type = $this
    ->createGroupType('example');
  $group = $this
    ->createGroup('example', 'example');
  $web_user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->drupalLogin($web_user);
  $this
    ->assertNodeOperationAccess('page', 'create', 403, 'Page nodes cannot be created by outsider without create page node permission');
  $group_type->outsider_permissions = array(
    'create page node',
  );
  $group_type
    ->save();
  $this
    ->assertNodeOperationAccess('page', 'create', 200, 'Page nodes can be created by outsider with create page node permission');
  $group_type->outsider_permissions = array(
    'administer group',
  );
  $group_type
    ->save();
  $this
    ->assertNodeOperationAccess('page', 'create', 200, 'Page nodes can be created by outsider with administer group permission');
}