Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
@ -214,7 +214,7 @@ class AccountSettingsForm extends ConfigFormBase {
|
|||
$form['email_admin_created']['user_mail_register_admin_created_body'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => $this->t('Body'),
|
||||
'#default_value' => $mail_config->get('register_admin_created.body'),
|
||||
'#default_value' => $mail_config->get('register_admin_created.body'),
|
||||
'#rows' => 15,
|
||||
);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class UserController extends ControllerBase {
|
|||
// A different user is already logged in on the computer.
|
||||
else {
|
||||
if ($reset_link_user = $this->userStorage->load($uid)) {
|
||||
drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href=":logout">logout</a> and try using the link again.',
|
||||
drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href=":logout">log out</a> and try using the link again.',
|
||||
array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), ':logout' => $this->url('user.logout'))), 'warning');
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -11,7 +11,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
|||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
* Maintenance mode subscriber to logout users.
|
||||
* Maintenance mode subscriber to log out users.
|
||||
*/
|
||||
class MaintenanceModeSubscriber implements EventSubscriberInterface {
|
||||
|
||||
|
|
|
@ -115,4 +115,3 @@ class UserPasswordResetForm extends FormBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,4 +50,3 @@ interface PermissionHandlerInterface {
|
|||
public function moduleProvidesPermissions($module_name);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,13 @@ class UserSelection extends DefaultSelection {
|
|||
*/
|
||||
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
|
||||
$query = parent::buildEntityQuery($match, $match_operator);
|
||||
$handler_settings = $this->configuration['handler_settings'];
|
||||
|
||||
// Filter out the Anonymous user if the selection handler is configured to
|
||||
// exclude it.
|
||||
if (isset($handler_settings['include_anonymous']) && !$handler_settings['include_anonymous']) {
|
||||
$query->condition('uid', 0, '<>');
|
||||
}
|
||||
|
||||
// The user entity doesn't have a label column.
|
||||
if (isset($match)) {
|
||||
|
@ -150,7 +157,6 @@ class UserSelection extends DefaultSelection {
|
|||
}
|
||||
|
||||
// Filter by role.
|
||||
$handler_settings = $this->configuration['handler_settings'];
|
||||
if (!empty($handler_settings['filter']['role'])) {
|
||||
$query->condition('roles', $handler_settings['filter']['role'], 'IN');
|
||||
}
|
||||
|
|
|
@ -163,4 +163,3 @@ class Role extends AccessPluginBase implements CacheableDependencyInterface {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -149,11 +149,11 @@ class UserAdminLanguageTest extends WebTestBase {
|
|||
/**
|
||||
* Sets the User interface negotiation detection method.
|
||||
*
|
||||
* @param bool $admin_first
|
||||
* Whether the admin negotiation should be first.
|
||||
*
|
||||
* Enables the "Account preference for administration pages" language
|
||||
* detection method for the User interface language negotiation type.
|
||||
*
|
||||
* @param bool $admin_first
|
||||
* Whether the admin negotiation should be first.
|
||||
*/
|
||||
function setLanguageNegotiation($admin_first = FALSE) {
|
||||
$edit = array(
|
||||
|
|
|
@ -86,7 +86,7 @@ class UserLanguageCreationTest extends WebTestBase {
|
|||
$this->drupalGet($user_edit);
|
||||
$this->assertOptionSelected("edit-preferred-langcode", $langcode, 'Language selector is accessible and correct language is selected.');
|
||||
|
||||
// Set pass_raw so we can login the new user.
|
||||
// Set pass_raw so we can log in the new user.
|
||||
$user->pass_raw = $this->randomMachineName(10);
|
||||
$edit = array(
|
||||
'pass[pass1]' => $user->pass_raw,
|
||||
|
|
|
@ -43,7 +43,7 @@ class UserLanguageTest extends WebTestBase {
|
|||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
|
||||
$this->drupalLogout();
|
||||
|
||||
// Login as normal user and edit account settings.
|
||||
// Log in as normal user and edit account settings.
|
||||
$this->drupalLogin($web_user);
|
||||
$path = 'user/' . $web_user->id() . '/edit';
|
||||
$this->drupalGet($path);
|
||||
|
|
|
@ -99,13 +99,13 @@ class UserRegistrationTest extends WebTestBase {
|
|||
$this->drupalPostForm('user/register', $edit, t('Create new account'));
|
||||
$this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
|
||||
|
||||
// Try to login before administrator approval.
|
||||
// Try to log in before administrator approval.
|
||||
$auth = array(
|
||||
'name' => $name,
|
||||
'pass' => $pass,
|
||||
);
|
||||
$this->drupalPostForm('user/login', $auth, t('Log in'));
|
||||
$this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot login yet.');
|
||||
$this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot log in yet.');
|
||||
|
||||
// Activate the new account.
|
||||
$accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
|
||||
|
@ -118,7 +118,7 @@ class UserRegistrationTest extends WebTestBase {
|
|||
$this->drupalPostForm('user/' . $new_user->id() . '/edit', $edit, t('Save'));
|
||||
$this->drupalLogout();
|
||||
|
||||
// Login after administrator approval.
|
||||
// Log in after administrator approval.
|
||||
$this->drupalPostForm('user/login', $auth, t('Log in'));
|
||||
$this->assertText(t('Member for'), 'User can log in after administrator approval.');
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
// Ensure this account is not blocked.
|
||||
$this->assertFalse($no_edit_user->isBlocked(), 'The user is not blocked.');
|
||||
|
||||
// Login as user admin.
|
||||
// Log in as user admin.
|
||||
$admin_user = $this->drupalCreateUser(array('administer users'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
|
@ -47,7 +47,7 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
|
||||
// Test blocking the account "no_edit".
|
||||
$edit = array(
|
||||
'user_bulk_form[' . ($no_edit_user->id() -1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($no_edit_user->id() - 1) . ']' => TRUE,
|
||||
'action' => 'user_block_user_action',
|
||||
);
|
||||
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
|
||||
|
@ -68,7 +68,7 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
$this->assertTrue($normal_user->access('update', $admin_user));
|
||||
|
||||
$edit = array(
|
||||
'user_bulk_form[' . ($normal_user->id() -1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($normal_user->id() - 1) . ']' => TRUE,
|
||||
'action' => 'user_block_user_action',
|
||||
);
|
||||
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
|
||||
|
@ -76,11 +76,11 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
$normal_user = User::load($normal_user->id());
|
||||
$this->assertTrue($normal_user->isBlocked(), 'The user is blocked.');
|
||||
|
||||
// Login as user without the 'administer users' permission.
|
||||
// Log in as user without the 'administer users' permission.
|
||||
$this->drupalLogin($this->drupalCreateUser());
|
||||
|
||||
$edit = array(
|
||||
'user_bulk_form[' . ($normal_user->id() -1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($normal_user->id() - 1) . ']' => TRUE,
|
||||
'action' => 'user_unblock_user_action',
|
||||
);
|
||||
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
|
||||
|
@ -98,7 +98,7 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
$account = $this->drupalCreateUser(array(), 'no_delete');
|
||||
$account2 = $this->drupalCreateUser(array(), 'may_delete');
|
||||
|
||||
// Login as user admin.
|
||||
// Log in as user admin.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('administer users')));
|
||||
|
||||
// Ensure that the account "no_delete" can not be deleted.
|
||||
|
@ -110,8 +110,8 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
|
||||
// Test deleting the accounts "no_delete" and "may_delete".
|
||||
$edit = array(
|
||||
'user_bulk_form[' . ($account->id() -1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($account2->id() -1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($account->id() - 1) . ']' => TRUE,
|
||||
'user_bulk_form[' . ($account2->id() - 1) . ']' => TRUE,
|
||||
'action' => 'user_cancel_user_action',
|
||||
);
|
||||
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
|
||||
|
|
|
@ -31,7 +31,7 @@ class BulkFormTest extends UserTestBase {
|
|||
* Tests the user bulk form.
|
||||
*/
|
||||
public function testBulkForm() {
|
||||
// Login as a user without 'administer users'.
|
||||
// Log in as a user without 'administer users'.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('administer permissions')));
|
||||
$user_storage = $this->container->get('entity.manager')->getStorage('user');
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests\Condition;
|
||||
namespace Drupal\Tests\user\Kernel\Condition;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
use Drupal\user\Entity\User;
|
||||
use Drupal\user\RoleInterface;
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests\Field;
|
||||
namespace Drupal\Tests\user\Kernel\Field;
|
||||
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
|
@ -51,7 +51,7 @@ class MigrateUserProfileEntityFormDisplayTest extends MigrateDrupal6TestBase {
|
|||
// Test that a checkbox field has the proper display label setting.
|
||||
$component = $display->getComponent('profile_love_migrations');
|
||||
$this->assertIdentical('boolean_checkbox', $component['type']);
|
||||
$this->assertIdentical(true, $component['settings']['display_label']);
|
||||
$this->assertIdentical(TRUE, $component['settings']['display_label']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class MigrateUserConfigsTest extends MigrateDrupal6TestBase {
|
|||
$this->assertIdentical('Account details for [user:name] at [site:name] (approved)', $config->get('status_activated.subject'));
|
||||
$this->assertIdentical("[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\n\nOnce you have set your own password, you will be able to log in to [site:login-url] in the future using:\n\nusername: [user:name]\n", $config->get('status_activated.body'));
|
||||
$this->assertIdentical('Replacement login information for [user:name] at [site:name]', $config->get('password_reset.subject'));
|
||||
$this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password." , $config->get('password_reset.body'));
|
||||
$this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.", $config->get('password_reset.body'));
|
||||
$this->assertIdentical('Account details for [user:name] at [site:name] (deleted)', $config->get('cancel_confirm.subject'));
|
||||
$this->assertIdentical("[user:name],\n\nYour account on [site:name] has been deleted.", $config->get('cancel_confirm.body'));
|
||||
$this->assertIdentical('An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject'));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\Core\KeyValueStore\KeyValueExpirableFactory;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\SharedTempStoreFactory;
|
||||
use Drupal\Core\Lock\DatabaseLockBackend;
|
||||
use Drupal\Core\Database\Database;
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\Core\Form\FormState;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Verifies that the field order in user account forms is compatible with
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
||||
/**
|
||||
|
@ -12,21 +12,21 @@ use Drupal\user\Entity\Role;
|
|||
*
|
||||
* @group user
|
||||
*/
|
||||
class UserEntityReferenceTest extends EntityUnitTestBase {
|
||||
class UserEntityReferenceTest extends EntityKernelTestBase {
|
||||
|
||||
use EntityReferenceTestTrait;
|
||||
|
||||
/**
|
||||
* A randomly-generated role for testing purposes.
|
||||
*
|
||||
* @var \Drupal\user\Entity\RoleInterface
|
||||
* @var \Drupal\user\RoleInterface
|
||||
*/
|
||||
protected $role1;
|
||||
|
||||
/**
|
||||
* A randomly-generated role for testing purposes.
|
||||
*
|
||||
* @var \Drupal\user\Entity\RoleInterface
|
||||
* @var \Drupal\user\RoleInterface
|
||||
*/
|
||||
protected $role2;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\User;
|
||||
use Drupal\user\RoleInterface;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\user\Entity\User;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests available user fields in twig.
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests user_install().
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Tests;
|
||||
namespace Drupal\Tests\user\Kernel;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Render\Element\Email;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
use Drupal\user\Entity\User;
|
||||
|
|
@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||
/**
|
||||
* @coversDefaultClass \Drupal\user\Access\PermissionAccessCheck
|
||||
* @group Routing
|
||||
* @group AccessF
|
||||
* @group Access
|
||||
*/
|
||||
class PermissionAccessCheckTest extends UnitTestCase {
|
||||
|
||||
|
|
|
@ -278,4 +278,3 @@ class PrivateTempStoreTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -350,4 +350,3 @@ class SharedTempStoreTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ function user_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<dt>' . t('Managing account settings') . '</dt>';
|
||||
$output .= '<dd>' . t('The <a href=":accounts">Account settings page</a> allows you to manage settings for the displayed name of the Anonymous user role, personal contact forms, user registration settings, and account cancellation settings. On this page you can also manage settings for account personalization, and adapt the text for the email messages that users receive when they register or request a password recovery. You may also set which role is automatically assigned new permissions whenever a module is enabled (the Administrator role).', array(':accounts' => \Drupal::url('entity.user.admin_form'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Managing user account fields') . '</dt>';
|
||||
$output .= '<dd>' . t('Because User accounts are an entity type, you can extend them by adding fields through the Manage fields tab on the <a href=":accounts">Account settings page</a>. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website. For background information on entities and fields, see the <a href=":field_help">Field module help page</a>.', array(':field_help'=>(\Drupal::moduleHandler()->moduleExists('field')) ? \Drupal::url('help.page', array('name' => 'field')) : '#', ':accounts' => \Drupal::url('entity.user.admin_form'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Because User accounts are an entity type, you can extend them by adding fields through the Manage fields tab on the <a href=":accounts">Account settings page</a>. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website. For background information on entities and fields, see the <a href=":field_help">Field module help page</a>.', array(':field_help' => (\Drupal::moduleHandler()->moduleExists('field')) ? \Drupal::url('help.page', array('name' => 'field')) : '#', ':accounts' => \Drupal::url('entity.user.admin_form'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
|
||||
|
@ -447,12 +447,12 @@ function user_template_preprocess_default_variables_alter(&$variables) {
|
|||
*
|
||||
* Default template: username.html.twig.
|
||||
*
|
||||
* Modules that make any changes to variables like 'name' or 'extra' must ensure
|
||||
* that the final string is safe.
|
||||
*
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - account: The user account (\Drupal\Core\Session\AccountInterface).
|
||||
*
|
||||
* Modules that make any changes to variables like 'name' or 'extra' must ensure
|
||||
* that the final string is safe.
|
||||
*/
|
||||
function template_preprocess_username(&$variables) {
|
||||
$account = $variables['account'] ?: new AnonymousUserSession();
|
||||
|
@ -564,7 +564,7 @@ function user_user_logout($account) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates a unique URL for a user to login and reset their password.
|
||||
* Generates a unique URL for a user to log in and reset their password.
|
||||
*
|
||||
* @param \Drupal\user\UserInterface $account
|
||||
* An object containing the user account.
|
||||
|
|
Reference in a new issue