Core and composer updates

This commit is contained in:
Rob Davies 2017-07-03 16:47:07 +01:00
parent a82634bb98
commit 62cac30480
1118 changed files with 21770 additions and 6306 deletions

View file

@ -32,11 +32,11 @@ process:
fallback_to_site_default: true
init: init
roles:
plugin: migration
plugin: migration_lookup
migration: d6_user_role
source: roles
user_picture:
plugin: migration
plugin: migration_lookup
migration: d6_user_picture_file
source: uid
no_stub: true

View file

@ -31,7 +31,7 @@ process:
fallback_to_site_default: true
init: init
roles:
plugin: migration
plugin: migration_lookup
migration: d7_user_role
source: roles
user_picture:
@ -40,7 +40,7 @@ process:
source: picture
default_value: null
-
plugin: migration
plugin: migration_lookup
migration: d7_file
destination:
plugin: entity:user

View file

@ -3,12 +3,12 @@
namespace Drupal\user\Plugin\migrate;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate_drupal\Plugin\migrate\CckMigration;
use Drupal\migrate_drupal\Plugin\migrate\FieldMigration;
/**
* Plugin class for Drupal 7 user migrations dealing with fields and profiles.
*/
class User extends CckMigration {
class User extends FieldMigration {
/**
* {@inheritdoc}
@ -30,16 +30,26 @@ class User extends CckMigration {
if (empty($field_type)) {
continue;
}
if ($this->cckPluginManager->hasDefinition($field_type)) {
if (!isset($this->cckPluginCache[$field_type])) {
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this);
if ($this->fieldPluginManager->hasDefinition($field_type)) {
if (!isset($this->fieldPluginCache[$field_type])) {
$this->fieldPluginCache[$field_type] = $this->fieldPluginManager->createInstance($field_type, [], $this);
}
$info = $row->getSource();
$this->cckPluginCache[$field_type]
->processCckFieldValues($this, $field_name, $info);
$this->fieldPluginCache[$field_type]
->processFieldValues($this, $field_name, $info);
}
else {
$this->process[$field_name] = $field_name;
if ($this->cckPluginManager->hasDefinition($field_type)) {
if (!isset($this->cckPluginCache[$field_type])) {
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this);
}
$info = $row->getSource();
$this->cckPluginCache[$field_type]
->processCckFieldValues($this, $field_name, $info);
}
else {
$this->process[$field_name] = $field_name;
}
}
}
}

View file

@ -74,6 +74,9 @@ class Roles extends ManyToOne {
*/
public function calculateDependencies() {
$dependencies = [];
if (in_array($this->operator, ['empty', 'not empty'])) {
return $dependencies;
}
foreach ($this->value as $role_id) {
$role = $this->roleStorage->load($role_id);
$dependencies[$role->getConfigDependencyKey()][] = $role->getConfigDependencyName();

View file

@ -5,10 +5,16 @@
*
* Available variables:
* - account: The full account information for the user.
* - name: The user's name, sanitized.
* - uid: The user ID, or zero if not a user. As used in anonymous comments.
* - name: The user's name, sanitized, and optionally truncated.
* - name_raw: The user's name, un-truncated.
* - truncated: Whether the user's name was truncated.
* - extra: Additional text to append to the user's name, sanitized.
* - profile_access: Whether the current user has permission to access this
users profile page.
* - link_path: The path or URL of the user's profile page, home page,
* or other desired page to link to for more information about the user.
* - homepage: (optional) The home page of the account, only set for non users.
* - link_options: Options to set on the \Drupal\Core\Url object if linking the
* user's name to the user's page.
* - attributes: HTML attributes for the containing element.

View file

@ -1,11 +1,11 @@
<?php
namespace Drupal\user\Tests;
namespace Drupal\Tests\user\Functional;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\simpletest\WebTestBase;
use Drupal\comment\CommentInterface;
use Drupal\comment\Entity\Comment;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\Entity\User;
/**
@ -13,7 +13,7 @@ use Drupal\user\Entity\User;
*
* @group user
*/
class UserCancelTest extends WebTestBase {
class UserCancelTest extends BrowserTestBase {
use CommentTestTrait;
@ -577,7 +577,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->getTextContent(), $account->getUsername() . ' has been deleted.') !== FALSE);
$user_storage->resetCache([$account->id()]);
$status = $status && !$user_storage->load($account->id());
}

View file

@ -39,15 +39,44 @@ class HandlerFilterRolesTest extends UserKernelTestBase {
'id' => 'roles_target_id',
'table' => 'user__roles',
'field' => 'roles_target_id',
'value' => [
'test_user_role' => 'test_user_role',
],
'value' => ['test_user_role' => 'test_user_role'],
'plugin_id' => 'user_roles',
];
$view->save();
$expected['config'][] = 'user.role.test_user_role';
$this->assertEqual($expected, $view->getDependencies());
$view = View::load('test_user_name');
$display = &$view->getDisplay('default');
$display['display_options']['filters']['roles_target_id'] = [
'id' => 'roles_target_id',
'table' => 'user__roles',
'field' => 'roles_target_id',
'value' => [
'test_user_role' => 'test_user_role',
],
'operator' => 'empty',
'plugin_id' => 'user_roles',
];
$view->save();
unset($expected['config']);
$this->assertEqual($expected, $view->getDependencies());
$view = View::load('test_user_name');
$display = &$view->getDisplay('default');
$display['display_options']['filters']['roles_target_id'] = [
'id' => 'roles_target_id',
'table' => 'user__roles',
'field' => 'roles_target_id',
'value' => [
'test_user_role' => 'test_user_role',
],
'operator' => 'not empty',
'plugin_id' => 'user_roles',
];
$view->save();
$this->assertEqual($expected, $view->getDependencies());
$view = Views::getView('test_user_name');
$view->initDisplay();
$view->initHandlers();
@ -63,7 +92,6 @@ class HandlerFilterRolesTest extends UserKernelTestBase {
'plugin_id' => 'user_roles',
];
$view->save();
unset($expected['config']);
$this->assertEqual($expected, $view->getDependencies());
}