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:
Pantheon Automation 2016-01-06 16:31:26 -08:00 committed by Greg Anderson
parent 1a0e9d9fac
commit a6b049dd05
538 changed files with 5247 additions and 1594 deletions

View file

@ -20,7 +20,7 @@ process:
default_value: visitors_admin_approval
map:
2: visitors_admin_approval
1: user_register
1: visitors
0: admin_only
anonymous: anonymous
destination:

View file

@ -41,7 +41,7 @@ class UserMailRequired extends Constraint implements ConstraintValidatorInterfac
protected $context;
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function initialize(ExecutionContextInterface $context) {
$this->context = $context;

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;
}
/**

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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']);
}
}
}

View file

@ -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());
}

View file

@ -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());
}

View file

@ -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');
}
/**

View file

@ -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')));
}
}

View file

@ -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();

View file

@ -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'] = [

View file

@ -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);
}
/**

View file

@ -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;

View file

@ -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.

View file

@ -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;

View file

@ -0,0 +1,243 @@
langcode: en
status: true
dependencies:
module:
- user
id: test_user_bulk_form_combine_filter
label: test_user_bulk_form_combine_filter
module: views
description: ''
tag: ''
base_table: users_field_data
base_field: uid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: full
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ' Previous'
next: 'Next '
first: '« First'
last: 'Last »'
quantity: 9
style:
type: default
row:
type: fields
fields:
user_bulk_form:
id: user_bulk_form
table: users
field: user_bulk_form
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
action_title: 'With selection'
include_exclude: exclude
selected_actions: { }
entity_type: user
plugin_id: user_bulk_form
name:
id: name
table: users_field_data
field: name
entity_type: user
entity_field: name
label: ''
alter:
alter_text: false
make_link: false
absolute: false
trim: false
word_boundary: false
ellipsis: false
strip_tags: false
html: false
hide_empty: false
empty_zero: false
plugin_id: field
relationship: none
group_type: group
admin_label: ''
exclude: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_alter_empty: true
click_sort_column: value
type: user_name
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
filters:
combine:
id: combine
table: views
field: combine
relationship: none
group_type: group
admin_label: ''
operator: contains
value: dummy
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
fields:
user_bulk_form: user_bulk_form
name: name
plugin_id: combine
sorts: { }
title: test_user_bulk_form_combine_filter
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
filter_groups:
operator: AND
groups:
1: AND
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: test-user-bulk-form-combine-filter
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }

View file

@ -61,7 +61,7 @@ class UserAccessControlHandlerTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$cache_contexts_manager = $this->prophesize(CacheContextsManager::class);