function TMGMTBaseTestCase::loginAsTranslator in Translation Management Tool 7
Will create a user with translator 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.
12 calls to TMGMTBaseTestCase::loginAsTranslator()
- TMGMTBaseTestCase::createLanguagesLoginTranslator in tests/
tmgmt.base.test - Adds languages as admin user and switches to a translator user.
- TMGMTEntitySourceUITestCase::dtestCommentTranslateTab in sources/
entity/ ui/ tmgmt_entity_ui.test - Test translating comments.
- TMGMTEntitySourceUITestCase::testCart in sources/
entity/ ui/ tmgmt_entity_ui.test - Test the entity source specific cart functionality.
- TMGMTEntitySourceUITestCase::testNodeTranslateTabMultipeCheckout in sources/
entity/ ui/ tmgmt_entity_ui.test - Test the translate tab for a single checkout.
- TMGMTEntitySourceUITestCase::testNodeTranslateTabSingleCheckout in sources/
entity/ ui/ tmgmt_entity_ui.test - Test the translate tab for a single checkout.
File
- tests/
tmgmt.base.test, line 116
Class
- TMGMTBaseTestCase
- Base class for tests.
Code
function loginAsTranslator($additional_permissions = array(), $reset_permissions = FALSE) {
$permissions = $this->translator_permissions;
if ($reset_permissions) {
$permissions = $additional_permissions;
}
elseif (!empty($additional_permissions)) {
$permissions = array_merge($permissions, $additional_permissions);
}
$this->translator_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->translator_user);
return $this->translator_user;
}