updated core to 8.6.3

This commit is contained in:
2018-11-21 12:49:46 +01:00
parent 8ca34853a3
commit c92c348eee
521 changed files with 12199 additions and 4578 deletions
@@ -165,7 +165,7 @@ class NodeEditFormTest extends NodeTestBase {
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertNoFieldByName('uid[0][target_id]');
// Now test with the Autcomplete (Tags) field widget.
// Now test with the Autocomplete (Tags) field widget.
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
$form_display = \Drupal::entityManager()->getStorage('entity_form_display')->load('node.page.default');
$widget = $form_display->getComponent('uid');
@@ -27,6 +27,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
'url.path.parent',
'url.query_args:_wrapper_format',
'user.roles',
'url.path.is_front',
// These two cache contexts are added by BigPipe.
'cookies:big_pipe_nojs',
'session.exists',
@@ -6,12 +6,12 @@ use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\NodeType;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\TestFileCreationTrait;
/**
@@ -70,6 +70,7 @@ class MigrateNodeTest extends MigrateDrupal7TestBase {
'd7_field_instance',
'd7_node',
'd7_node_translation',
'd7_entity_translation_settings',
'd7_node_entity_translation',
]);
}
@@ -181,14 +182,6 @@ class MigrateNodeTest extends MigrateDrupal7TestBase {
$this->assertEquals(CommentItemInterface::OPEN, $node->comment_node_test_content_type->status);
$this->assertEquals('3.1416', $node->field_float_list[0]->value);
// Test that fields translated with Entity Translation are migrated.
$node_fr = $node->getTranslation('fr');
$this->assertEquals('A French Node', $node_fr->getTitle());
$this->assertEquals('6', $node_fr->field_integer->value);
$node_is = $node->getTranslation('is');
$this->assertEquals('An Icelandic Node', $node_is->getTitle());
$this->assertEquals('7', $node_is->field_integer->value);
$node = Node::load(2);
$this->assertEquals('en', $node->langcode->value);
$this->assertEquals("...is that it's the absolute best show ever. Trust me, I would know.", $node->body->value);
@@ -228,4 +221,42 @@ class MigrateNodeTest extends MigrateDrupal7TestBase {
$this->assertEquals(CommentItemInterface::OPEN, $node->comment_forum->status);
}
/**
* Test node entity translations migration from Drupal 7 to 8.
*/
public function testNodeEntityTranslations() {
$manager = $this->container->get('content_translation.manager');
// Get the node and its translations.
$node = Node::load(1);
$node_fr = $node->getTranslation('fr');
$node_is = $node->getTranslation('is');
// Test that fields translated with Entity Translation are migrated.
$this->assertSame('An English Node', $node->getTitle());
$this->assertSame('A French Node', $node_fr->getTitle());
$this->assertSame('An Icelandic Node', $node_is->getTitle());
$this->assertSame('5', $node->field_integer->value);
$this->assertSame('6', $node_fr->field_integer->value);
$this->assertSame('7', $node_is->field_integer->value);
// Test that the French translation metadata is correctly migrated.
$metadata_fr = $manager->getTranslationMetadata($node_fr);
$this->assertSame('en', $metadata_fr->getSource());
$this->assertTrue($metadata_fr->isOutdated());
$this->assertSame('2', $node_fr->getOwnerId());
$this->assertSame('1529615802', $node_fr->getCreatedTime());
$this->assertSame('1529615802', $node_fr->getChangedTime());
$this->assertTrue($node_fr->isPublished());
// Test that the Icelandic translation metadata is correctly migrated.
$metadata_is = $manager->getTranslationMetadata($node_is);
$this->assertSame('en', $metadata_is->getSource());
$this->assertFalse($metadata_is->isOutdated());
$this->assertSame('1', $node_is->getOwnerId());
$this->assertSame('1529615813', $node_is->getCreatedTime());
$this->assertSame('1529615813', $node_is->getChangedTime());
$this->assertFalse($node_is->isPublished());
}
}
@@ -44,9 +44,9 @@ class NodeEntityTranslationTest extends MigrateSqlSourceTestBase {
'revision_id' => 2,
'language' => 'fr',
'source' => 'en',
'uid' => 1,
'uid' => 2,
'status' => 1,
'translate' => 0,
'translate' => 1,
'created' => 1531343508,
'changed' => 1531343508,
],
@@ -57,7 +57,7 @@ class NodeEntityTranslationTest extends MigrateSqlSourceTestBase {
'language' => 'es',
'source' => 'en',
'uid' => 1,
'status' => 1,
'status' => 0,
'translate' => 0,
'created' => 1531343528,
'changed' => 1531343528,
@@ -280,12 +280,14 @@ class NodeEntityTranslationTest extends MigrateSqlSourceTestBase {
// The expected results.
$tests[0]['expected_data'] = [
[
'entity_type' => 'node',
'entity_id' => 2,
'revision_id' => 2,
'language' => 'fr',
'source' => 'en',
'uid' => 1,
'uid' => 2,
'status' => 1,
'translate' => 1,
'created' => 1531343508,
'changed' => 1531343508,
'type' => 'page',
@@ -304,12 +306,14 @@ class NodeEntityTranslationTest extends MigrateSqlSourceTestBase {
],
],
[
'entity_type' => 'node',
'entity_id' => 2,
'revision_id' => 2,
'language' => 'es',
'source' => 'en',
'uid' => 1,
'status' => 1,
'status' => 0,
'translate' => 0,
'created' => 1531343528,
'changed' => 1531343528,
'type' => 'page',
@@ -422,6 +422,169 @@ class NodeTest extends MigrateSqlSourceTestBase {
],
];
// The source data with a correct 'entity_translation' table.
$tests[1]['source_data']['entity_translation'] = [
[
'entity_type' => 'node',
'entity_id' => 1,
'revision_id' => 1,
'language' => 'en',
'source' => '',
'uid' => 1,
'status' => 1,
'translate' => 0,
'created' => 1279051598,
'changed' => 1279051598,
],
[
'entity_type' => 'node',
'entity_id' => 1,
'revision_id' => 1,
'language' => 'fr',
'source' => 'en',
'uid' => 1,
'status' => 1,
'translate' => 0,
'created' => 1279051598,
'changed' => 1279051598,
],
];
$tests[1]['source_data']['field_config'] = [
[
'id' => '1',
'translatable' => '1',
],
];
$tests[1]['source_data']['field_config_instance'] = [
[
'id' => '1',
'field_id' => '1',
'field_name' => 'body',
'entity_type' => 'node',
'bundle' => 'page',
'data' => 'a:0:{}',
'deleted' => '0',
],
];
$tests[1]['source_data']['field_revision_body'] = [
[
'entity_type' => 'node',
'bundle' => 'page',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'en',
'delta' => '0',
'body_value' => 'English body',
'body_summary' => '',
'body_format' => 'filtered_html',
],
[
'entity_type' => 'node',
'bundle' => 'page',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'fr',
'delta' => '0',
'body_value' => 'French body',
'body_summary' => '',
'body_format' => 'filtered_html',
],
];
$tests[1]['source_data']['node'] = [
[
'nid' => 1,
'vid' => 1,
'type' => 'page',
'language' => 'en',
'title' => 'Node Title',
'uid' => 1,
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
],
];
$tests[1]['source_data']['node_revision'] = [
[
'nid' => 1,
'vid' => 1,
'uid' => 1,
'title' => 'Node Title',
'log' => '',
'timestamp' => 1279051598,
'status' => 1,
'comment' => 2,
'promote' => 1,
'sticky' => 0,
],
];
$tests[1]['source_data']['variable'] = [
[
'name' => 'entity_translation_entity_types',
'value' => 'a:4:{s:7:"comment";i:0;s:4:"node";s:4:"node";s:13:"taxonomy_term";i:0;s:4:"user";i:0;}',
],
[
'name' => 'language_content_type_page',
'value' => 's:1:"4";',
],
];
// The expected results with a correct 'entity_translation' table.
// entity_translation table.
$tests[1]['expected_data'] = [
[
'nid' => 1,
'vid' => 1,
'type' => 'page',
'language' => 'en',
'title' => 'Node Title',
'node_uid' => 1,
'revision_uid' => 1,
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'sticky' => 0,
'tnid' => 1,
'translate' => 0,
'log' => '',
'timestamp' => 1279051598,
'body' => [
[
'value' => 'English body',
'summary' => '',
'format' => 'filtered_html',
],
],
],
];
// Repeat the previous test with an incorrect 'entity_translation' table
// where the row with the empty 'source' property is missing.
$tests[2]['source_data'] = $tests[1]['source_data'];
$tests[2]['source_data']['entity_translation'] = [
[
'entity_type' => 'node',
'entity_id' => 1,
'revision_id' => 1,
'language' => 'fr',
'source' => 'en',
'uid' => 1,
'status' => 1,
'translate' => 0,
'created' => 1279051598,
'changed' => 1279051598,
],
];
$tests[2]['expected_data'] = $tests[1]['expected_data'];
return $tests;
}