Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -19,6 +19,7 @@ process:
-
plugin: skip_on_empty
method: row
label: name
'settings/handler': 'constants/selection_handler'
'settings/handler_settings/target_bundles/0': '@field_name'
'settings/handler_settings/auto_create': 'constants/auto_create'

View file

@ -1,30 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\destination\EntityTaxonomyTerm.
*/
namespace Drupal\taxonomy\Plugin\migrate\destination;
use Drupal\migrate\Row;
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
/**
* @MigrateDestination(
* id = "entity:taxonomy_term"
* )
*/
class EntityTaxonomyTerm extends EntityContentBase {
/**
* {@inheritdoc}
*/
protected function getEntity(Row $row, array $old_destination_id_values) {
if ($row->isStub()) {
$row->setDestinationProperty('name', $this->t('Stub name for source tid:') . $row->getSourceProperty('tid'));
}
return parent::getEntity($row, $old_destination_id_values);
}
}

View file

@ -0,0 +1,118 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Migrate\MigrateTaxonomyTermStubTest.
*/
namespace Drupal\taxonomy\Tests\Migrate;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
use Drupal\migrate_drupal\Tests\StubTestTrait;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Test stub creation for taxonomy terms.
*
* @group taxonomy
*/
class MigrateTaxonomyTermStubTest extends MigrateDrupalTestBase {
use StubTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy', 'text'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('taxonomy_term');
}
/**
* Tests creation of taxonomy term stubs.
*/
public function testStub() {
Vocabulary::create([
'vid' => 'test_vocabulary',
'name' => 'Test vocabulary',
])->save();
$this->performStubTest('taxonomy_term');
}
/**
* Tests creation of stubs when weight is mapped.
*/
public function testStubWithWeightMapping() {
// Create a vocabulary via migration for the terms to reference.
$vocabulary_data_rows = [
['id' => '1', 'name' => 'tags'],
];
$ids = ['id' => ['type' => 'integer']];
$config = [
'id' => 'vocabularies',
'migration_tags' => ['Stub test'],
'source' => [
'plugin' => 'embedded_data',
'data_rows' => $vocabulary_data_rows,
'ids' => $ids,
],
'process' => [
'vid' => 'id',
'name' => 'name',
],
'destination' => ['plugin' => 'entity:taxonomy_vocabulary'],
];
$vocabulary_migration = Migration::create($config);
$vocabulary_executable = new MigrateExecutable($vocabulary_migration, $this);
$vocabulary_executable->import();
// We have a term referencing an unmigrated parent, forcing a stub to be
// created.
$term_data_rows = [
['id' => '1', 'vocab' => '1', 'name' => 'music', 'parent' => '2'],
];
$ids = ['id' => ['type' => 'integer']];
$config = [
'id' => 'terms',
'migration_tags' => ['Import and rollback test'],
'source' => [
'plugin' => 'embedded_data',
'data_rows' => $term_data_rows,
'ids' => $ids,
],
'process' => [
'tid' => 'id',
'vid' => 'vocab',
'name' => 'name',
'weight' => 'weight',
'parent' => [
'plugin' => 'migration',
'migration' => 'terms',
'source' => 'parent',
],
],
'destination' => ['plugin' => 'entity:taxonomy_term'],
'migration_dependencies' => ['required' => ['vocabularies']],
];
$term_migration = Migration::create($config);
$term_migration->save();
$term_executable = new MigrateExecutable($term_migration, $this);
$term_executable->import();
// Load the referenced term, which should exist as a stub.
/** @var \Drupal\Core\Entity\ContentEntityBase $stub_entity */
$stub_entity = Term::load(2);
$this->assertTrue($stub_entity, 'Stub successfully created');
if ($stub_entity) {
$this->assertIdentical(count($stub_entity->validate()), 0, 'Stub is a valid entity');
}
}
}

View file

@ -39,11 +39,13 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
$field_id = 'node.article.tags';
$field = FieldConfig::load($field_id);
$this->assertIdentical($field_id, $field->id(), 'Field instance exists on article bundle.');
$this->assertIdentical('Tags', $field->label());
// Test the page bundle as well.
$field_id = 'node.page.tags';
$field = FieldConfig::load($field_id);
$this->assertIdentical($field_id, $field->id(), 'Field instance exists on page bundle.');
$this->assertIdentical('Tags', $field->label());
$settings = $field->getSettings();
$this->assertIdentical('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.');

View file

@ -23,6 +23,7 @@ entity.taxonomy_term.edit_form:
_admin_route: TRUE
requirements:
_entity_access: 'taxonomy_term.update'
taxonomy_term: \d+
entity.taxonomy_term.delete_form:
path: '/taxonomy/term/{taxonomy_term}/delete'
@ -33,6 +34,7 @@ entity.taxonomy_term.delete_form:
_admin_route: TRUE
requirements:
_entity_access: 'taxonomy_term.delete'
taxonomy_term: \d+
entity.taxonomy_vocabulary.add_form:
path: '/admin/structure/taxonomy/add'
@ -82,3 +84,4 @@ entity.taxonomy_term.canonical:
_title_callback: '\Drupal\taxonomy\Controller\TaxonomyController::termTitle'
requirements:
_entity_access: 'taxonomy_term.view'
taxonomy_term: \d+