Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2549801: Improve source provider missing exception message.
Problem/Motivation
DrupalSqlBase doesn't include requirements in exception. Requirements can be used by code catching exceptions to interact with the missing requirements in a structured manner.
Proposed resolution
Re-add requirements to the requirement exception in DrupalSqlBase and assert that we can see them without munging the exception message.
Comment | File | Size | Author |
---|---|---|---|
#2 | drupalsqlbase_doesn_t-2790111-2.patch | 2.36 KB | neclimdul |
Comments
Comment #2
neclimdulI moved the
setExpectedException
as well because the only real benefit over the annotation is that we can assert where the exception happens by calling the assertion directly before the method call. So if we're going to use it lets do that.Comment #3
mikeryanIs it worth checking getRequirementsString() as well?
Comment #4
neclimdulWe could though we're not testing the exception so much as the fact that the requirements exist on the exception so I'm not sure if its needed.
Comment #5
mikeryanOK!
Comment #6
fgmSlightly related, since it is a dependency/requirements issue, there is (at least in 8.2.0-beta3) a logic inversion: DrupalSqlBase is part of migrate_drupal, but migrate depends on it: most (all ?) of the migrate Source plugins inherit from DrupalSqlBase, so it should be moved to migrate, otherwise no migration can run without enabling migrate_drupal, although non-D2D migrations don't need it.
Comment #7
mikeryan@fgm: No, DrupalSqlBase is only needed when migrating from Drupal and does belong in migrate_drupal. The reason non-Drupal migrations currently need to have migrate_drupal enabled is being addressed in #2560795: Source plugins have a hidden dependency on migrate_drupal.
Comment #8
fgmTerrific issue title :-)
Comment #10
xjmNice, improved debugging and a test to boot. Committed 6f7f400 and pushed to 8.3.x and 8.2.x. Thanks!