Problem/Motivation

Now that #2859304: Show field type migrations correctly in Migrate Drupal UI is in the cck and field migrations need 'source_module' and 'destination_module' added to the annotations.

See change record, Migrate field plugins now require source_module and destination_module

Proposed resolution

Add the following to the cck and the field plugin.

 *   source_module = "addressfield",
 *   destination_module = "address"

Remaining tasks

Write the patch
review

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

quietone’s picture

Status: Active » Needs review

set to NR for testing

heddn’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community
heddn’s picture

Priority: Major » Critical
FileSize
228 bytes

Tests only patch. Hopefully this shows that tests here are failing. Which justifies a critical priority.

heddn’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.59 KB

OK, this should show a test failure.

heddn’s picture

FileSize
2.58 KB
heddn’s picture

Are we testing against core 8.5.x HEAD? I cannot tell. When I ran the tests locally against 8.5.x HEAD, they failed for the patch in #6.

quietone’s picture

Issue tags: +blocker

I get the same results as heddn, the test only patch in #6 fails.

Looking at the console output from the testbot, that new test isn't running

14:20:51 Drupal\Tests\address\Unit\Plugin\Validation\Constraint\Count   5 passes                                      
14:20:52 Drupal\Tests\address\Kernel\ZoneItemTest                       1 passes                                      
14:20:53 Drupal\Tests\address\Kernel\Formatter\CountryDefaultFormatte   1 passes                                      
14:20:53 Drupal\Tests\address\Kernel\Formatter\AddressPlainFormatterT   1 passes                                      
14:20:57 Drupal\Tests\address\Kernel\Formatter\AddressDefaultFormatte   4 passes                                      
14:21:30 Drupal\Tests\address\Functional\Views\AdministrativeAreaFilt   4 passes                                      
14:21:30 

Why isn't it running?

tagging as a blocker because it is prevent work in commerce_migrate on lots of issues.

quietone’s picture

It was a namespace error on the test, also added a comment and a space.

The last submitted patch, 10: 2920118-fail-10.patch, failed testing. View results

joshmiller’s picture

Status: Needs review » Reviewed & tested by the community

Functionally applies and the tests speak for themselves. Definitely confusing to the use the term "cck" (a very D6 term) in regards to a very D7 module, "addressfield." I can only surmise this is because we're dealing with ubercart or we're defining something that can cross both D6 and D7 paths.

Just be aware, in D6 world "addressfield" is meaningless.

quietone’s picture

Status: Reviewed & tested by the community » Needs review

@joshmiller, thanks for the review!

Just be aware, in D6 world "addressfield" is meaningless.

The source_module is addressfield because the project page for address states, "The Drupal 8 heir to the addressfield module, powered by the commerceguys/addressing library."

quietone’s picture

Status: Needs review » Reviewed & tested by the community

It was a mistake to change to NR.

googletorp’s picture

Status: Reviewed & tested by the community » Needs work

I'm not familiar with the migrate code, so I don't want to commit any changes.

Overall the code looks good to me, but there are a few flaws:

--- a/src/Plugin/migrate/cckfield/AddressField.php
+++ b/src/Plugin/migrate/cckfield/AddressField.php
@@ -13,8 +13,10 @@ use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
* id = "addressfield",
* core = {7},
* type_map = {
- * "addressfield" = "address"
- * }
+ * "addressfield" = "address",
+ * },
+ * source_module = "addressfield",
+ * destination_module = "address"

You have add a comma to this line:

* "addressfield" = "address"

That is a mistake.

@@ -15,6 +15,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
class AddressFieldTest extends KernelTestBase {

/**
+ * Modules to enable.
+ *
* @var array
*/
public static $modules = [
@@ -28,9 +30,10 @@ class AddressFieldTest extends KernelTestBase {
*/
public function testPlugin() {
$migration = $this->prophesize(MigrationInterface::class)->reveal();
- $field_plugin = $this->container
- ->get('plugin.manager.migrate.field')
- ->createInstance('addressfield', [], $migration);
+ $field_plugin_manager = $this->container
+ ->get('plugin.manager.migrate.field');
+ $field_plugin_manager->getDefinition('addressfield');
+ $field_plugin = $field_plugin_manager->createInstance('addressfield', [], $migration);
$this->assertInstanceOf(AddressField::class, $field_plugin);
}

In the above code you have added

$field_plugin_manager->getDefinition('addressfield');

As far as I can tell, this doesn't do anything and is not used for anything. If the call to getDefinition is done to test that some internal things are not broken, you should add a comment about what you are doing here, otherwise as I read the code you can simply delete this line. The same is done in the other test case.

heddn’s picture

#15 points are all addressed in this patch. The trailing annotation comma was out of scope code cleanup. I've added an assert not empty on the definition. We are testing that the plugin discovery process is possible and we don't throw any exceptions. But let's assert not empty too to make it more clear. Discovery would throw an exception well before it is ever empty, but this is more obvious.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

Applied that patch, ran the test, code reviewed. Sorry about the trailing annotation comma, seems I added that in the first patch. Yes that is for another issue.

Therefor RTBC it is.

  • bojanz committed 5908f05 on 8.x-1.x authored by heddn
    Issue #2920118 by heddn, quietone: Update cck and field migration plugin
    
bojanz’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

quietone’s picture

@bojanz, @googletorp. Thank you!

Status: Fixed » Closed (fixed)

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