function TMGMTBaseTestCase::loginAsAdmin in Translation Management Tool 7
Will create a user with admin permissions and log it in.
Parameters
array $additional_permissions: Additional permissions that will be granted to admin user.
boolean $reset_permissions: Flag to determine if default admin permissions will be replaced by $additional_permissions.
Return value
object Newly created and logged in user object.
24 calls to TMGMTBaseTestCase::loginAsAdmin()
- TMGMTBaseTestCase::createLanguagesLoginTranslator in tests/
tmgmt.base.test - Adds languages as admin user and switches to a translator user.
- TMGMTEntitySourceLanguageNoneTestCase::setUp in sources/
entity/ tmgmt_entity.source.none.test - Overrides DrupalWebTestCase::setUp()
- TMGMTEntitySourceListTestCase::setUp in sources/
entity/ ui/ tmgmt_entity_ui.list.test - Overrides DrupalWebTestCase::setUp()
- TMGMTEntitySourcePathAutoTestCase::setUp in sources/
entity/ tmgmt_entity.pathauto.test - Overrides DrupalWebTestCase::setUp()
- TMGMTEntitySourceTestCase::setUp in sources/
entity/ tmgmt_entity.source.test - Overrides DrupalWebTestCase::setUp()
File
- tests/
tmgmt.base.test, line 89
Class
- TMGMTBaseTestCase
- Base class for tests.
Code
function loginAsAdmin($additional_permissions = array(), $reset_permissions = FALSE) {
$permissions = $this->admin_permissions;
if ($reset_permissions) {
$permissions = $additional_permissions;
}
elseif (!empty($additional_permissions)) {
$permissions = array_merge($permissions, $additional_permissions);
}
$this->admin_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->admin_user);
return $this->admin_user;
}