trait LoginAdminTrait

Test trait for logging admin in JS tests.


4 files declare their use of LoginAdminTrait
ParagraphsCollectionStyleTest.php in paragraphs_collection/tests/src/FunctionalJavascript/ParagraphsCollectionStyleTest.php
ParagraphsCollectionStyleTest.php in paragraphs_collection/tests/src/Functional/ParagraphsCollectionStyleTest.php
ParagraphsLibraryItemTranslationTest.php in paragraphs/modules/paragraphs_library/tests/src/Functional/ParagraphsLibraryItemTranslationTest.php
ParagraphsStylePluginTest.php in paragraphs_collection/tests/src/FunctionalJavascript/ParagraphsStylePluginTest.php


paragraphs/tests/src/FunctionalJavascript/LoginAdminTrait.php, line 8


View source
trait LoginAdminTrait {

   * Creates an user with admin permissions and log in.
   * @param array $additional_permissions
   *   Additional permissions that will be granted to admin user.
   * @param bool $reset_permissions
   *   Flag to determine if default admin permissions will be replaced by
   *   $additional_permissions.
   * @return object
   *   Newly created and logged in user object.
  public function loginAsAdmin($additional_permissions = [], $reset_permissions = FALSE) {
    $permissions = [
      'administer content types',
      'administer node fields',
      'administer paragraphs types',
      'administer node form display',
      'administer paragraph fields',
      'administer paragraph form display',
      'bypass node access',
    if ($reset_permissions) {
      $permissions = $additional_permissions;
    elseif (!empty($additional_permissions)) {
      $permissions = array_merge($permissions, $additional_permissions);
    $this->admin_user = $this
    return $this->admin_user;



Namesort descending Modifiers Type Description Overrides
LoginAdminTrait::loginAsAdmin public function Creates an user with admin permissions and log in.