protected function OpignoWebTestCase::getRoleId in Opigno 7
Fetch the role ID by name.
Parameters
string $role_name:
Return value
int
1 call to OpignoWebTestCase::getRoleId()
- OpignoWebTestCase::addMemberToCourse in tests/
OpignoWebTestCase.test - Add member to course.
File
- tests/
OpignoWebTestCase.test, line 143 - 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 getRoleId($role_name) {
$rid = db_select('og_role', 'r')
->fields('r', array(
'rid',
))
->condition('r.name', $role_name)
->condition('group_bundle', OPIGNO_COURSE_BUNDLE)
->execute()
->fetchField();
return !empty($rid) ? $rid : 0;
}