Update to drupal-org-drupal 8.0.0-rc2. For more information, see https://www.drupal.org/node/2598668
This commit is contained in:
parent
f32e58e4b1
commit
8e18df8c36
3062 changed files with 15044 additions and 172506 deletions
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\EntityContentBaseTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class EntityContentBaseTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['migrate_overwrite_test'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a field on the user entity so that we can test nested property
|
||||
// overwrites.
|
||||
// @see static::testOverwriteSelectedNestedProperty()
|
||||
FieldStorageConfig::create([
|
||||
'field_name' => 'signature',
|
||||
'entity_type' => 'user',
|
||||
'type' => 'text_long',
|
||||
])->save();
|
||||
|
||||
FieldConfig::create([
|
||||
'field_name' => 'signature',
|
||||
'entity_type' => 'user',
|
||||
'bundle' => 'user',
|
||||
])->save();
|
||||
|
||||
User::create([
|
||||
'uid' => 2,
|
||||
'name' => 'Ford Prefect',
|
||||
'mail' => 'ford.prefect@localhost',
|
||||
'signature' => array(
|
||||
array(
|
||||
'value' => 'Bring a towel.',
|
||||
'format' => 'filtered_html',
|
||||
),
|
||||
),
|
||||
'init' => 'proto@zo.an',
|
||||
])->save();
|
||||
|
||||
$this->executeMigrations(['d6_filter_format', 'd6_user_role']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests overwriting all mapped properties in the destination entity (default
|
||||
* behavior).
|
||||
*/
|
||||
public function testOverwriteAllMappedProperties() {
|
||||
$this->executeMigration('d6_user');
|
||||
/** @var \Drupal\user\UserInterface $account */
|
||||
$account = User::load(2);
|
||||
$this->assertIdentical('john.doe', $account->label());
|
||||
$this->assertIdentical('john.doe@example.com', $account->getEmail());
|
||||
$this->assertIdentical('doe@example.com', $account->getInitialEmail());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests overwriting selected properties in the destination entity, specified
|
||||
* in the destination configuration.
|
||||
*/
|
||||
public function testOverwriteProperties() {
|
||||
// Execute the migration in migrate_overwrite_test, which documents how
|
||||
// property overwrites work.
|
||||
$this->executeMigration('users');
|
||||
|
||||
/** @var \Drupal\user\UserInterface $account */
|
||||
$account = User::load(2);
|
||||
$this->assertIdentical('john.doe', $account->label());
|
||||
$this->assertIdentical('john.doe@example.com', $account->getEmail());
|
||||
$this->assertIdentical('The answer is 42.', $account->signature->value);
|
||||
// This value is not overwritten because it's not listed in
|
||||
// overwrite_properties.
|
||||
$this->assertIdentical('proto@zo.an', $account->getInitialEmail());
|
||||
}
|
||||
|
||||
}
|
8610
core/modules/migrate_drupal/tests/fixtures/drupal6.php
vendored
8610
core/modules/migrate_drupal/tests/fixtures/drupal6.php
vendored
File diff suppressed because it is too large
Load diff
1398
core/modules/migrate_drupal/tests/fixtures/drupal7.php
vendored
1398
core/modules/migrate_drupal/tests/fixtures/drupal7.php
vendored
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,6 @@
|
|||
name: 'Migrate property overwrite test'
|
||||
type: module
|
||||
description: 'Example module demonstrating property overwrite support in the Migrate API.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
|
@ -0,0 +1,31 @@
|
|||
id: users
|
||||
label: User migration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
- Drupal 7
|
||||
source:
|
||||
plugin: d6_user
|
||||
process:
|
||||
# If the entity's ID is migrated, the Migrate API will try to update
|
||||
# an existing entity with that ID. If no entity with that ID already
|
||||
# exists, it will be created.
|
||||
uid: uid
|
||||
name: name
|
||||
mail: mail
|
||||
password: password
|
||||
'signature/value':
|
||||
plugin: default_value
|
||||
default_value: 'The answer is 42.'
|
||||
destination:
|
||||
plugin: entity:user
|
||||
# If the destination is going to update an existing user, you can optionally
|
||||
# specify the properties that should be overwritten. For example, if the
|
||||
# migration tries to import user 31 and user 31 already exists in the
|
||||
# destination database, only the 'name' and 'mail' properties of the user
|
||||
# will be overwritten. If user 31 doesn't exist, it will be created and
|
||||
# the overwrite_properties list will be ignored.
|
||||
overwrite_properties:
|
||||
- name
|
||||
- mail
|
||||
# It's possible to overwrite nested properties too.
|
||||
- 'signature/value'
|
Reference in a new issue