Add functional test for creating/editing migrations

Created on 9 November 2019, about 5 years ago
Updated 4 June 2023, over 1 year ago

Problem/Motivation

We already have a FunctionalJavascript test that covers the case for creating and editing migrations. What this test doesn't cover however is PHP notices that are shown on screen (or written to the log).

While creating or editing migrations several PHP warnings occur, for example:

Notice: Undefined index: urls
Drupal\migrate_plus\Plugin\migrate\source\Url->__construct()

This makes it hard to provide test coverage for creating and editing migrations, because the tests fail on these PHP notices.

This is because plugins in Migrate Plus don't account for the case that some configuration is not set yet. In the example above the MigrateSource plugin "url" assumes that $configuration['urls'] always exists. This is not the case when a migration is just created in the UI.

Steps to reproduce

  • Install Feeds Migrate, Feeds Migrate UI, Migrate Plus, Migrate Tools
  • Go to /admin/structure/migrate/sources/add

Proposed resolution

To fix this, Migrate Plus plugins should implement \Drupal\Component\Plugin\ConfigurableInterface. But before that can happen, Migrate plugin base classes should implement it first. But before that can be done, there should exist an uniform way to merge configuration in plugins first.

I think being able to add test coverage is vitally important to make the project maintainable. Therefore I think this issue is a blocker for making further progress on the project.

There could be a workaround: we could override/replace plugins from Migrate Plus and fix the issues we have in there. But I rather would like to have the base to be good.

Remaining tasks

  1. 📌 Create a trait and base class to implement \Drupal\Component\Plugin\ConfigurableInterface Needs review
  2. #2937177: [PP-1] Migrate plugin base classes should implement ConfigurablePluginInterface
  3. Implement defaultConfiguration() for migrate plugins in Migrate Plus (for MigrateSource plugin "url" and probably others)
  4. Rerun tests provided on this issue and adjust them if necessary
📌 Task
Status

Postponed

Version

1.0

Component

Code

Created by

🇳🇱Netherlands megachriz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024