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

@ -9,7 +9,7 @@ process:
# the tid field to allow incremental migrations.
tid: tid
vid:
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
name: name
@ -22,7 +22,7 @@ process:
method: process
source: parent
-
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_term
parent:
plugin: default_value

View file

@ -10,7 +10,7 @@ process:
plugin: machine_name
source: name
-
plugin: dedupe_entity
plugin: make_unique_entity_field
entity_type: taxonomy_vocabulary
field: vid
length: 32

View file

@ -8,7 +8,7 @@ source:
process:
nid:
-
plugin: migration
plugin: migration_lookup
migration: d6_node
source: nid
-

View file

@ -8,7 +8,7 @@ source:
process:
vid:
-
plugin: migration
plugin: migration_lookup
migration: d6_node
source: vid
-

View file

@ -15,9 +15,16 @@ process:
entity_type: 'constants/entity_type'
view_mode: 'constants/view_mode'
options: 'constants/options'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
destination:

View file

@ -19,9 +19,16 @@ process:
0: options_select
1: entity_reference_autocomplete_tags
options/weight: 'constants/options/weight'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
destination:

View file

@ -13,7 +13,7 @@ process:
type: 'constants/type'
field_name:
-
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
-

View file

@ -10,10 +10,17 @@ source:
selection_handler: 'default:taxonomy_term'
process:
entity_type: 'constants/entity_type'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
-
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
-

View file

@ -10,7 +10,7 @@ process:
# the tid field to allow incremental migrations.
tid: tid
vid:
plugin: migration
plugin: migration_lookup
migration: d7_taxonomy_vocabulary
source: vid
name: name
@ -24,7 +24,7 @@ process:
method: process
source: parent
-
plugin: migration
plugin: migration_lookup
migration: d7_taxonomy_term
parent:
plugin: default_value

View file

@ -5,7 +5,16 @@ migration_tags:
source:
plugin: d7_taxonomy_vocabulary
process:
vid: machine_name
vid:
-
plugin: machine_name
source: name
-
plugin: make_unique_entity_field
entity_type: taxonomy_vocabulary
field: vid
length: 32
migrated: true
label: name
name: name
description: description

View file

@ -9,12 +9,14 @@ use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\Plugin\MigrationDeriverTrait;
use Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManagerInterface;
use Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Deriver for Drupal 7 taxonomy term migrations based on vocabularies.
*/
class D7TaxonomyTermDeriver extends DeriverBase implements ContainerDeriverInterface {
use MigrationDeriverTrait;
/**
@ -38,6 +40,20 @@ class D7TaxonomyTermDeriver extends DeriverBase implements ContainerDeriverInter
*/
protected $cckPluginManager;
/**
* Already-instantiated field plugins, keyed by ID.
*
* @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface[]
*/
protected $fieldPluginCache;
/**
* The field plugin manager.
*
* @var \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface
*/
protected $fieldPluginManager;
/**
* D7TaxonomyTermDeriver constructor.
*
@ -45,10 +61,13 @@ class D7TaxonomyTermDeriver extends DeriverBase implements ContainerDeriverInter
* The base plugin ID for the plugin ID.
* @param \Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManagerInterface $cck_manager
* The CCK plugin manager.
* @param \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_manager
* The field plugin manager.
*/
public function __construct($base_plugin_id, MigrateCckFieldPluginManagerInterface $cck_manager) {
public function __construct($base_plugin_id, MigrateCckFieldPluginManagerInterface $cck_manager, MigrateFieldPluginManagerInterface $field_manager) {
$this->basePluginId = $base_plugin_id;
$this->cckPluginManager = $cck_manager;
$this->fieldPluginManager = $field_manager;
}
/**
@ -57,7 +76,8 @@ class D7TaxonomyTermDeriver extends DeriverBase implements ContainerDeriverInter
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
$container->get('plugin.manager.migrate.cckfield')
$container->get('plugin.manager.migrate.cckfield'),
$container->get('plugin.manager.migrate.field')
);
}
@ -112,15 +132,25 @@ class D7TaxonomyTermDeriver extends DeriverBase implements ContainerDeriverInter
foreach ($fields[$bundle] as $field_name => $info) {
$field_type = $info['type'];
try {
$plugin_id = $this->cckPluginManager->getPluginIdFromFieldType($field_type, ['core' => 7], $migration);
if (!isset($this->cckPluginCache[$field_type])) {
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($plugin_id, ['core' => 7], $migration);
$plugin_id = $this->fieldPluginManager->getPluginIdFromFieldType($field_type, ['core' => 7], $migration);
if (!isset($this->fieldPluginCache[$field_type])) {
$this->fieldPluginCache[$field_type] = $this->fieldPluginManager->createInstance($plugin_id, ['core' => 7], $migration);
}
$this->cckPluginCache[$field_type]
->processCckFieldValues($migration, $field_name, $info);
$this->fieldPluginCache[$field_type]
->processFieldValues($migration, $field_name, $info);
}
catch (PluginNotFoundException $ex) {
$migration->setProcessOfProperty($field_name, $field_name);
try {
$plugin_id = $this->cckPluginManager->getPluginIdFromFieldType($field_type, ['core' => 7], $migration);
if (!isset($this->cckPluginCache[$field_type])) {
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($plugin_id, ['core' => 7], $migration);
}
$this->cckPluginCache[$field_type]
->processCckFieldValues($migration, $field_name, $info);
}
catch (PluginNotFoundException $ex) {
$migration->setProcessOfProperty($field_name, $field_name);
}
}
}
}

View file

@ -18,6 +18,8 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
* @deprecated in Drupal 8.3.0, intended to be removed in Drupal 9.0.0.
* Use \Drupal\taxonomy\Plugin\migrate\source\d6\Term or
* \Drupal\taxonomy\Plugin\migrate\source\d7\Term.
*
* @see https://www.drupal.org/node/2879193
*/
class Term extends DrupalSqlBase {

View file

@ -85,7 +85,7 @@ interface TermInterface extends ContentEntityInterface, EntityChangedInterface {
/**
* Get the taxonomy vocabulary id this term belongs to.
*
* @return int
* @return string
* The id of the vocabulary.
*/
public function getVocabularyId();

View file

@ -19,7 +19,7 @@ process:
name: name
weight: weight
parent:
plugin: migration
plugin: migration_lookup
migration: taxonomy_term_stub_test
source: parent
destination:

View file

@ -14,7 +14,7 @@ class MigrateTermNodeRevisionTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}

View file

@ -15,7 +15,7 @@ class MigrateTermNodeTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}

View file

@ -15,20 +15,31 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['field', 'taxonomy'];
public static $modules = ['field', 'taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_node_type',
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
'd6_vocabulary_field_instance',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyEntityDisplay() {
$this->executeMigration('d6_vocabulary_entity_display');
// Test that the field exists.
$component = EntityViewDisplay::load('node.page.default')->getComponent('tags');
$this->assertIdentical('entity_reference_label', $component['type']);
@ -37,4 +48,23 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
$this->assertIdentical(['node', 'article', 'default', 'tags'], $this->getMigration('d6_vocabulary_entity_display')->getIdMap()->lookupDestinationID([4, 'article']));
}
/**
* Tests that vocabulary displays are ignored appropriately.
*
* Vocabulary displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_entity_display should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_entity_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}

View file

@ -15,20 +15,31 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
'd6_vocabulary_field_instance',
'd6_vocabulary_entity_display',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyEntityFormDisplay() {
$this->executeMigration('d6_vocabulary_entity_form_display');
// Test that the field exists.
$component = EntityFormDisplay::load('node.page.default')->getComponent('tags');
$this->assertIdentical('options_select', $component['type']);
@ -42,4 +53,23 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
$this->assertIdentical($entity_form_display->getComponent('vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags');
}
/**
* Tests that vocabulary displays are ignored appropriately.
*
* Vocabulary displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_entity_form_display should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_entity_form_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}

View file

@ -15,20 +15,30 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_node_type',
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyFieldInstance() {
$this->executeMigration('d6_vocabulary_field_instance');
// Test that the field exists.
$field_id = 'node.article.tags';
$field = FieldConfig::load($field_id);
@ -50,10 +60,29 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
$this->assertIdentical(['node', 'article', 'tags'], $this->getMigration('d6_vocabulary_field_instance')->getIdMap()->lookupDestinationID([4, 'article']));
// Test the the field vocabulary_1_i_0_
// Test the the field vocabulary_1_i_0_.
$field_id = 'node.story.vocabulary_1_i_0_';
$field = FieldConfig::load($field_id);
$this->assertFalse($field->isRequired(), 'Field is not required');
}
/**
* Tests that vocabulary field instances are ignored appropriately.
*
* Vocabulary field instances should be ignored when they belong to node
* types which were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_field_instance should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_field_instance');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}

View file

@ -15,7 +15,7 @@ class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}

View file

@ -20,6 +20,7 @@ class MigrateNodeTaxonomyTest extends MigrateDrupal7TestBase {
'filter',
'image',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',

View file

@ -18,6 +18,7 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase {
'datetime',
'image',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',

View file

@ -57,6 +57,7 @@ class MigrateTaxonomyVocabularyTest extends MigrateDrupal7TestBase {
$this->assertEntity('tags', 'Tags', 'Use tags to group articles on similar topics into categories.', VocabularyInterface::HIERARCHY_DISABLED, 0);
$this->assertEntity('forums', 'Forums', 'Forum navigation vocabulary', VocabularyInterface::HIERARCHY_SINGLE, -10);
$this->assertEntity('test_vocabulary', 'Test Vocabulary', 'This is the vocabulary description', VocabularyInterface::HIERARCHY_SINGLE, 0);
$this->assertEntity('vocabulary_name_much_longer_than', 'vocabulary name much longer than thirty two characters', 'description of vocabulary name much longer than thirty two characters', VocabularyInterface::HIERARCHY_SINGLE, 0);
}
}