You are here

function ModuleGrantsEntityTestCase::assertEntityViewAllAccess in Module Grants 7

1 call to ModuleGrantsEntityTestCase::assertEntityViewAllAccess()
ModuleGrantsEntityTestCase::testNodeViewAllAccess in module_grants_entity/module_grants_entity.test

File

module_grants_entity/module_grants_entity.test, line 49

Class

ModuleGrantsEntityTestCase

Code

function assertEntityViewAllAccess($permissions, $access) {

  // create the user
  $permissions += array(
    'access content',
  );
  $account = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($account);
  $msg = t("User with permissions @permissions @access to entity_access('view', 'node').", array(
    '@permissions' => implode(',', $permissions),
    '@access' => $access ? 'has access' : 'has no access',
  ));
  $this
    ->drupalGet('entity_access_test_page');
  $this
    ->assertResponse(200, "Entity access test page is displayed");
  $this
    ->assertNoText('Exception', "No database exception");
  if ($access) {
    $this
      ->assertText("Yes", $msg);
  }
  else {
    $this
      ->assertText('No', $msg);
  }
}