From 99aac33ceff757f0290a3f80c7e4a7b84e2eab97 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Fri, 27 Jan 2017 15:45:58 +0000
Subject: [PATCH] Issue #2557557 by erozqba, quietone, cebasqueira,
 phenaproxima: Move old CCK assertions into MigrateNodeTest

---
 .../src/Kernel/Migrate/d6/MigrateNodeTest.php    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
index 7a0a272a13ef..15b6d77ecd9c 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
@@ -57,6 +57,8 @@ public function testNode() {
     $node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
     $this->assertIdentical('Test title', $node_revision->getTitle());
     $this->assertIdentical('1', $node_revision->getRevisionUser()->id(), 'Node revision has the correct user');
+    $this->assertSame('1', $node_revision->id(), 'Node 1 loaded.');
+    $this->assertSame('1', $node_revision->getRevisionId(), 'Node 1 revision 1 loaded.');
     // This is empty on the first revision.
     $this->assertIdentical(NULL, $node_revision->revision_log->value);
     $this->assertIdentical('This is a shared text field', $node->field_test->value);
@@ -89,6 +91,20 @@ public function testNode() {
     $this->assertIdentical('Drupal Groups', $node->field_test_link->title);
     $this->assertIdentical([], $node->field_test_link->options['attributes']);
 
+    $node = Node::load(3);
+    // Test multivalue field.
+    $value_1 = $node->field_multivalue->value;
+    $value_2 = $node->field_multivalue[1]->value;
+
+    // SQLite does not support scales for float data types so we need to convert
+    // the value manually.
+    if ($this->container->get('database')->driver() == 'sqlite') {
+      $value_1 = sprintf('%01.2f', $value_1);
+      $value_2 = sprintf('%01.2f', $value_2);
+    }
+    $this->assertSame('33.00', $value_1);
+    $this->assertSame('44.00', $value_2);
+
     // Test that a link field with an internal link is migrated.
     $node = Node::load(9);
     $this->assertSame('internal:/node/10', $node->field_test_link->uri);
-- 
GitLab