protected function OpignoWebTestCase::createRole in Opigno 7
Create a role and set the permissions.
Parameters
string $role_name:
array $permissions = array():
Return value
object
File
- tests/
OpignoWebTestCase.test, line 128 - Defines the base class for Opigno unit testing. This base class contains re-usable logic that will make it easier and faster to write Opigno-specific unit tests.
Class
- OpignoWebTestCase
- @file Defines the base class for Opigno unit testing. This base class contains re-usable logic that will make it easier and faster to write Opigno-specific unit tests.
Code
protected function createRole($role_name, $permissions = array()) {
$role = og_role_create($role_name, 'node', 0, OPIGNO_COURSE_BUNDLE);
og_role_save($role);
og_role_grant_permissions($role->rid, $permissions);
return $role;
}