diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeByNodeTypeTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeByNodeTypeTest.php index cb0b671..ae2123e 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeByNodeTypeTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeByNodeTypeTest.php @@ -86,6 +86,10 @@ class NodeByNodeTypeTest extends MigrateSqlSourceTestCase { */ protected function setUp() { $database_contents = $this->expectedResults; + array_walk($this->expectedResults, function ($row) { + $row['node_uid'] = $row['uid']; + $row['revision_uid'] = $row['uid'] + 1; + }); $database_contents[] = array( // Node fields. @@ -115,11 +119,17 @@ protected function setUp() { // Add another row with an article node and make sure it is not migrated. foreach ($database_contents as $k => $row) { - foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $i => $field) { + foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) { $this->databaseContents['node_revisions'][$k][$field] = $row[$field]; - // Keep nid and vid. - if ($i > 1) { - unset($row[$field]); + switch ($field) { + case 'nid': case 'vid': + break; + case 'uid': + $this->databaseContents['node_revisions'][$k]['uid']++; + break; + default: + unset($row[$field]); + break; } } $this->databaseContents['node'][$k] = $row; diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeTest.php index 81e84cd..b2621be 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeTest.php @@ -109,15 +109,25 @@ class NodeTest extends MigrateSqlSourceTestCase { */ protected function setUp() { foreach ($this->expectedResults as $k => $row) { - foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'log', 'timestamp', 'format') as $i => $field) { + foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) { $this->databaseContents['node_revisions'][$k][$field] = $row[$field]; - // Keep nid and vid. - if ($i > 1) { - unset($row[$field]); + switch ($field) { + case 'nid': case 'vid': + break; + case 'uid': + $this->databaseContents['node_revisions'][$k]['uid']++; + break; + default: + unset($row[$field]); + break; } } $this->databaseContents['node'][$k] = $row; } + array_walk($this->expectedResults, function ($row) { + $row['node_uid'] = $row['uid']; + $row['revision_uid'] = $row['uid'] + 1; + }); parent::setUp(); }