Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes
This commit is contained in:
parent
1a0e9d9fac
commit
a6b049dd05
538 changed files with 5247 additions and 1594 deletions
|
@ -41,7 +41,7 @@ class UserMailRequired extends Constraint implements ConstraintValidatorInterfac
|
|||
protected $context;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function initialize(ExecutionContextInterface $context) {
|
||||
$this->context = $context;
|
||||
|
|
|
@ -44,7 +44,7 @@ class UserNameConstraintValidator extends ConstraintValidator {
|
|||
'\x{FEFF}' . // Byte order mark
|
||||
'\x{FF01}-\x{FF60}' . // Full-width latin
|
||||
'\x{FFF9}-\x{FFFD}' . // Replacement characters
|
||||
'\x{0}-\x{1F}]/u', // NULL byte and control characters
|
||||
'\x{0}-\x{1F}]/u', // NULL byte and control characters
|
||||
$name)
|
||||
) {
|
||||
$this->context->addViolation($constraint->illegalMessage);
|
||||
|
|
|
@ -101,8 +101,12 @@ class Name extends InOperator {
|
|||
// prevent array filter from removing our anonymous user.
|
||||
}
|
||||
|
||||
// Override to do nothing.
|
||||
public function getValueOptions() { }
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValueOptions() {
|
||||
return $this->valueOptions;
|
||||
}
|
||||
|
||||
public function adminSummary() {
|
||||
// set up $this->valueOptions for the parent summary
|
||||
|
|
|
@ -78,6 +78,7 @@ class Permissions extends ManyToOne {
|
|||
$display_name = $this->moduleHandler->getName($provider);
|
||||
$this->valueOptions[$display_name][$perm] = Html::escape(strip_tags($perm_item['title']));
|
||||
}
|
||||
return $this->valueOptions;
|
||||
}
|
||||
else {
|
||||
return $this->valueOptions;
|
||||
|
|
|
@ -60,6 +60,8 @@ class Roles extends ManyToOne {
|
|||
public function getValueOptions() {
|
||||
$this->valueOptions = user_role_names(TRUE);
|
||||
unset($this->valueOptions[RoleInterface::AUTHENTICATED_ID]);
|
||||
return $this->valueOptions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,16 +77,16 @@ class PrivateTempStore {
|
|||
* The key/value storage object used for this data. Each storage object
|
||||
* represents a particular collection of data and will contain any number
|
||||
* of key/value pairs.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lockBackend
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
|
||||
* The lock object used for this data.
|
||||
* @param mixed $owner
|
||||
* The owner key to store along with the data (e.g. a user or session ID).
|
||||
* @param int $expire
|
||||
* The time to live for items, in seconds.
|
||||
*/
|
||||
public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
|
||||
public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
|
||||
$this->storage = $storage;
|
||||
$this->lockBackend = $lockBackend;
|
||||
$this->lockBackend = $lock_backend;
|
||||
$this->currentUser = $current_user;
|
||||
$this->requestStack = $request_stack;
|
||||
$this->expire = $expire;
|
||||
|
|
|
@ -55,16 +55,20 @@ class PrivateTempStoreFactory {
|
|||
/**
|
||||
* Constructs a Drupal\user\PrivateTempStoreFactory object.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection $connection
|
||||
* The connection object used for this data.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lockBackend
|
||||
* @param \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $storage_factory
|
||||
* The key/value store factory.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
|
||||
* The lock object used for this data.
|
||||
* @param \Drupal\Core\Session\AccountProxyInterface $current_user
|
||||
* The current account.
|
||||
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
|
||||
* The request stack.
|
||||
* @param int $expire
|
||||
* The time to live for items, in seconds.
|
||||
*/
|
||||
function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lockBackend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
|
||||
function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
|
||||
$this->storageFactory = $storage_factory;
|
||||
$this->lockBackend = $lockBackend;
|
||||
$this->lockBackend = $lock_backend;
|
||||
$this->currentUser = $current_user;
|
||||
$this->requestStack = $request_stack;
|
||||
$this->expire = $expire;
|
||||
|
|
|
@ -86,7 +86,7 @@ class SharedTempStore {
|
|||
* The key/value storage object used for this data. Each storage object
|
||||
* represents a particular collection of data and will contain any number
|
||||
* of key/value pairs.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lockBackend
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
|
||||
* The lock object used for this data.
|
||||
* @param mixed $owner
|
||||
* The owner key to store along with the data (e.g. a user or session ID).
|
||||
|
@ -95,9 +95,9 @@ class SharedTempStore {
|
|||
* @param int $expire
|
||||
* The time to live for items, in seconds.
|
||||
*/
|
||||
public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, $owner, RequestStack $request_stack, $expire = 604800) {
|
||||
public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, $owner, RequestStack $request_stack, $expire = 604800) {
|
||||
$this->storage = $storage;
|
||||
$this->lockBackend = $lockBackend;
|
||||
$this->lockBackend = $lock_backend;
|
||||
$this->owner = $owner;
|
||||
$this->requestStack = $request_stack;
|
||||
$this->expire = $expire;
|
||||
|
|
|
@ -47,18 +47,18 @@ class SharedTempStoreFactory {
|
|||
/**
|
||||
* Constructs a Drupal\user\SharedTempStoreFactory object.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection $connection
|
||||
* The connection object used for this data.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lockBackend
|
||||
* @param \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $storage_factory
|
||||
* The key/value store factory.
|
||||
* @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
|
||||
* The lock object used for this data.
|
||||
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
|
||||
* The request stack.
|
||||
* @param int $expire
|
||||
* The time to live for items, in seconds.
|
||||
*/
|
||||
function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lockBackend, RequestStack $request_stack, $expire = 604800) {
|
||||
function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, RequestStack $request_stack, $expire = 604800) {
|
||||
$this->storageFactory = $storage_factory;
|
||||
$this->lockBackend = $lockBackend;
|
||||
$this->lockBackend = $lock_backend;
|
||||
$this->requestStack = $request_stack;
|
||||
$this->expire = $expire;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Drupal\user\Tests\Migrate\d6;
|
|||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\user\AccountSettingsForm;
|
||||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Upgrade variables to user.*.yml.
|
||||
|
@ -24,6 +26,8 @@ class MigrateUserConfigsTest extends MigrateDrupal6TestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('system', 'router');
|
||||
$this->container->get('router.builder')->rebuild();
|
||||
$this->executeMigrations(['d6_user_mail', 'd6_user_settings']);
|
||||
}
|
||||
|
||||
|
@ -60,6 +64,34 @@ class MigrateUserConfigsTest extends MigrateDrupal6TestBase {
|
|||
$this->assertIdentical(FALSE, $config->get('verify_mail'));
|
||||
$this->assertIdentical('admin_only', $config->get('register'));
|
||||
$this->assertIdentical('Guest', $config->get('anonymous'));
|
||||
|
||||
// Tests migration of user_register using the AccountSettingsForm.
|
||||
|
||||
// Map D6 value to D8 value
|
||||
$user_register_map = [
|
||||
[0, USER_REGISTER_ADMINISTRATORS_ONLY],
|
||||
[1, USER_REGISTER_VISITORS],
|
||||
[2, USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL],
|
||||
];
|
||||
|
||||
foreach ($user_register_map as $map) {
|
||||
// Tests migration of user_register = 1
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('variable')
|
||||
->fields(['value' => serialize($map[0])])
|
||||
->condition('name', 'user_register')
|
||||
->execute();
|
||||
|
||||
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
|
||||
$migration = \Drupal::entityManager()
|
||||
->getStorage('migration')
|
||||
->loadUnchanged('d6_user_settings');
|
||||
// Indicate we're rerunning a migration that's already run.
|
||||
$migration->getIdMap()->prepareUpdate();
|
||||
$this->executeMigration($migration);
|
||||
$form = $this->container->get('form_builder')->getForm(AccountSettingsForm::create($this->container));
|
||||
$this->assertIdentical($map[1], $form['registration_cancellation']['user_register']['#value']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ class MigrateUserFloodTest extends MigrateDrupal7TestBase {
|
|||
'ip_window' => 7200,
|
||||
'user_limit' => 22,
|
||||
'user_window' => 86400,
|
||||
'_core' => [
|
||||
'default_config_hash' => 'UYfMzeP1S8jKm9PSvxf7nQNe8DsNS-3bc2WSNNXBQWs',
|
||||
],
|
||||
];
|
||||
$this->assertIdentical($expected, $this->config('user.flood')->get());
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ class UserCancelTest extends WebTestBase {
|
|||
$this->drupalPostForm(NULL, NULL, t('Cancel accounts'));
|
||||
$status = TRUE;
|
||||
foreach ($users as $account) {
|
||||
$status = $status && (strpos($this->content, $account->getUsername() . '</em> has been deleted.') !== FALSE);
|
||||
$status = $status && (strpos($this->content, $account->getUsername() . '</em> has been deleted.') !== FALSE);
|
||||
$user_storage->resetCache(array($account->id()));
|
||||
$status = $status && !$user_storage->load($account->id());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class UserLoginTest extends WebTestBase {
|
|||
$this->drupalGet('user/login', array('query' => array('destination' => 'foo')));
|
||||
$edit = array('name' => $user->getUserName(), 'pass' => $user->pass_raw);
|
||||
$this->drupalPostForm(NULL, $edit, t('Log in'));
|
||||
$this->assertUrl('foo', [], 'Redirected to the correct URL');
|
||||
$this->assertUrl('foo', [], 'Redirected to the correct URL');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class BulkFormTest extends UserTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_user_bulk_form');
|
||||
public static $testViews = array('test_user_bulk_form', 'test_user_bulk_form_combine_filter');
|
||||
|
||||
/**
|
||||
* Tests the user bulk form.
|
||||
|
@ -130,4 +130,14 @@ class BulkFormTest extends UserTestBase {
|
|||
$this->assertOption('edit-action', $action_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the user bulk form with a combined field filter on the bulk column.
|
||||
*/
|
||||
public function testBulkFormCombineFilter() {
|
||||
// Add a user.
|
||||
$account = entity_load('user', $this->users[0]->id());
|
||||
$view = Views::getView('test_user_bulk_form_combine_filter');
|
||||
$errors = $view->validate();
|
||||
$this->assertEqual(reset($errors['default']), t('Field %field set in %filter is not usable for this filter type. Combined field filter only works for simple fields.', array('%field' => 'User: Bulk update', '%filter' => 'Global: Combine fields filter')));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ class HandlerFilterPermissionTest extends UserKernelTestBase {
|
|||
|
||||
$view->initDisplay();
|
||||
$view->initHandlers();
|
||||
$view->filter['permission']->getValueOptions();
|
||||
|
||||
// Test the value options.
|
||||
$value_options = $view->filter['permission']->getValueOptions();
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Drupal\user\Tests\Views;
|
|||
|
||||
use Drupal\user\Entity\Role;
|
||||
use Drupal\views\Entity\View;
|
||||
use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Tests the roles filter handler.
|
||||
|
@ -52,6 +53,11 @@ class HandlerFilterRolesTest extends UserKernelTestBase {
|
|||
$expected['config'][] = 'user.role.test_user_role';
|
||||
$this->assertEqual($expected, $view->getDependencies());
|
||||
|
||||
$view = Views::getView('test_user_name');
|
||||
$view->initDisplay();
|
||||
$view->initHandlers();
|
||||
$this->assertEqual(array_keys($view->filter['roles_target_id']->getValueOptions()), ['test_user_role']);
|
||||
|
||||
$view = View::load('test_user_name');
|
||||
$display = &$view->getDisplay('default');
|
||||
$display['display_options']['filters']['roles_target_id'] = [
|
||||
|
|
|
@ -83,6 +83,8 @@ class HandlerFilterUserNameTest extends ViewTestBase {
|
|||
|
||||
$this->executeView($view);
|
||||
$this->assertIdenticalResultset($view, array(array('uid' => $this->accounts[0]->id())), $this->columnMap);
|
||||
|
||||
$this->assertEqual($view->filter['uid']->getValueOptions(), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,6 +56,8 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
|
|||
* The config factory.
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
* @param \Drupal\Core\Routing\AdminContext $admin_context
|
||||
* The route admin context to determine whether the route is an admin one.
|
||||
*/
|
||||
public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, AdminContext $admin_context) {
|
||||
$this->user = $user;
|
||||
|
|
|
@ -17,7 +17,7 @@ interface UserDataInterface {
|
|||
*
|
||||
* @param string $module
|
||||
* The name of the module the data is associated with.
|
||||
* @param integer $uid
|
||||
* @param int $uid
|
||||
* (optional) The user account ID the data is associated with.
|
||||
* @param string $name
|
||||
* (optional) The name of the data key.
|
||||
|
@ -41,7 +41,7 @@ interface UserDataInterface {
|
|||
*
|
||||
* @param string $module
|
||||
* The name of the module the data is associated with.
|
||||
* @param integer $uid
|
||||
* @param int $uid
|
||||
* The user account ID the data is associated with.
|
||||
* @param string $name
|
||||
* The name of the data key.
|
||||
|
@ -58,7 +58,7 @@ interface UserDataInterface {
|
|||
* @param string|array $module
|
||||
* (optional) The name of the module the data is associated with. Can also
|
||||
* be an array to delete the data of multiple modules.
|
||||
* @param integer|array $uid
|
||||
* @param int|array $uid
|
||||
* (optional) The user account ID the data is associated with. If omitted,
|
||||
* all data for $module is deleted. Can also be an array of IDs to delete
|
||||
* the data of multiple user accounts.
|
||||
|
|
|
@ -58,7 +58,7 @@ class UserListBuilder extends EntityListBuilder {
|
|||
* @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination
|
||||
* The redirect destination service.
|
||||
*/
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, QueryFactory $query_factory, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) {
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, QueryFactory $query_factory, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) {
|
||||
parent::__construct($entity_type, $storage);
|
||||
$this->queryFactory = $query_factory;
|
||||
$this->dateFormatter = $date_formatter;
|
||||
|
|
Reference in a new issue