Suggested commit message:

Issue #2143415 by YesCT, mikeryan, marvil07, bdone, chx: Migrate fixes

Here's a potpourri of small fixes that went into the sandbox since commit. Notable changes:

  1. needsUpdate has been renamed to sourceRowStatus in #2140201: Rename map needs_update column
  2. mapTable to mapTableName and messageTable to messageTableName in #2142111: Map/message table name getters
  3. MigrateExecutable::getTimeLimit is now functional.
  4. lookupSourceID and lookupDestinationID now returns a list of identifier values instead of an associated array in #2137517: Write PHPUnit tests for SQL.php: lookupDestinationID()
  5. FakeSelect works after a FakeInsert/Update/Merge. Ongoing discussion on the database contents between classes in #2142285: Database contents not sufficiently persistent
  6. Doxygen fixes
CommentFileSizeAuthor
migrate_2a.patch31.87 KBchx

Comments

chx’s picture

Issue summary: View changes
chx’s picture

Issue summary: View changes
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

SP: do you have a tag for all migrate issues?
Regarding the pace question in the other issue: at some point we just switch from sandbox/module development to use the core issue queue all the time.

  1. +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/id_map/Sql.php
    @@ -400,7 +418,7 @@ public function saveIdMapping(Row $row, array $destination_id_values, $needs_upd
    -      'needs_update' => (int) $needs_update,
    +      'source_row_status' => (int) $source_row_status,
    

    Just for example this change is really nice!

  2. +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeDatabaseSchema.php
    @@ -14,11 +14,14 @@ class FakeDatabaseSchema extends Schema {
       /**
        * As set on MigrateSqlSourceTestCase::databaseContents.
    +   *
    +   * @var array
    ...
    -  protected $databaseContents;
    +  public $databaseContents;
    

    It took me a while to understand how this variable looks like. Can we document that better in a follow up? Additional, what is the reason for making this public?

  3. +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeDatabaseSchema.php
    @@ -84,7 +87,7 @@ public function dropPrimaryKey($table) {
       public function dropTable($table) {
    -    throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__));
    +    unset($this->databaseContents[$table]);
       }
    

    <3

chx’s picture

databaseContents is very well documented on FakeSelect.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0d61dd8 and pushed to 8.x. Thanks!

Did a minor doc fix for spelling and formatting on the way in. Yes I know we are referring to sql commands but I think the capitalisation is unnecessary and UPDATE'd is fugly - plus this would the fist instance of this in our codebase.

diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateTestCase.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateTestCase.php
index 1f9e349..40d9f63 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateTestCase.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateTestCase.php
@@ -61,8 +61,8 @@ protected function getDatabase($database_contents) {
     $database->databaseContents = &$database_contents;

     // Although select doesn't modify the contents of the database, it still
-    // eneds to be a reference so that we can SELECT previously INSERT /
-    // UPDATE'd rows.
+    // needs to be a reference so that we can select previously inserted or
+    // updated rows.
     $database->expects($this->any())
       ->method('select')->will($this->returnCallback(function ($base_table, $base_alias) use (&$database_contents) {
       return new FakeSelect($base_table, $base_alias, $database_contents);

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.