protected function getCredentialsFor( $roleIdentifier )
    {
        $roleService = $this->getRepository()->getRoleService();

        // First try to load role, throws exception if not found.
        $role = $this->getRepository()->sudo(
            function() use ( $roleService, $roleIdentifier )
            {
                // make sure role name starts with uppercase as this is what default setup provides
                if ($roleIdentifier !== ucfirst($roleIdentifier)) {
                    @trigger_error(
                        "'{$roleIdentifier}' role name should start with uppercase letter",
                        E_USER_DEPRECATED
                    );
                }

                return $roleService->loadRoleByIdentifier(ucfirst($roleIdentifier));
            }
        );

        // create a new user, uses 'User' trait
        $username = $this->findNonExistingUserName();
        $password = $this->getUserManager()->getDefaultPassword();
        $email = "${username}@ez.no";
        $user = $this->getUserManager()->ensureUserExists( $username, $email, $password );

        // Assign role to created user (without limitation)
        $this->getRepository()->sudo(
            function() use ( $roleService, $role, $user )
            {
                return $roleService->assignRoleToUser(
                    $role,
                    $user
                );
            }
        );

        return array(
            'login'     => $username,
            'password'  => $password,
        );
    }