function TmgmtTestTrait::loginAsAdmin in Translation Management Tool 8
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.
34 calls to TmgmtTestTrait::loginAsAdmin()
- ConfigSourceListTest::setUp in sources/
tmgmt_config/ tests/ src/ Functional/ ConfigSourceListTest.php - Overrides DrupalWebTestCase::setUp()
- ConfigSourceUiTest::setUp in sources/
tmgmt_config/ tests/ src/ Functional/ ConfigSourceUiTest.php - Overrides DrupalWebTestCase::setUp()
- ConfigSourceUiTest::testFieldConfigTranslateTabSingleCheckout in sources/
tmgmt_config/ tests/ src/ Functional/ ConfigSourceUiTest.php - Test the field config entity type for a single checkout.
- ContentEntitySourceContentModerationTest::setUp in sources/
content/ tests/ src/ Functional/ ContentEntitySourceContentModerationTest.php - Overrides DrupalWebTestCase::setUp()
- ContentEntitySourceTranslatableEntityTest::setUp in sources/
content/ tests/ src/ Functional/ ContentEntitySourceTranslatableEntityTest.php - Overrides DrupalWebTestCase::setUp()
File
- tests/
src/ Functional/ TmgmtTestTrait.php, line 70
Class
- TmgmtTestTrait
- Base class for tests.
Namespace
Drupal\Tests\tmgmt\FunctionalCode
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;
}