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.
Problem/Motivation
A test in Commerce Migrate that checks the migration states is failing with
1) Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ValidateMigrationStateTest::testMigrationState
sort() expects parameter 1 to be array, null given
It happens here where on <code>sort($declared[MigrationState::NOT_FINISHED])
because sort($declared[MigrationState::NOT_FINISHED]) is NULL.
I have a memory of intending to fix that when I wrote the test trait, ValidateMigrationStateTestTrait.php, and obviously forgot to.
Steps to reproduce
Proposed resolution
Set a default for the two arrays in $declared to [].
$declared[MigrationState::FINISHED] = [];
$declared[MigrationState::NOT_FINISHED] = [];
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#14 | 3204461-14.patch | 1.08 KB | larowlan |
#14 | 3204461-interdiff-14.txt | 1.17 KB | larowlan |
#9 | 3204461-9.patch | 797 bytes | quietone |
#9 | interdiff--2-9.txt | 703 bytes | quietone |
#2 | 3204461-2.patch | 818 bytes | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedComment #3
quietone CreditAttribution: quietone as a volunteer commentedComment #4
quietone CreditAttribution: quietone as a volunteer commentedComment #5
quietone CreditAttribution: quietone as a volunteer commentedComment #6
mparker17I've been adding D7 (and D6) migrations for a bunch of contrib modules on a site I need to migrate to D8, and I've been running into this issue - see https://www.drupal.org/pift-ci-job/1979943 for example.
I'd really like to see this get in, and backported to D9.1, D9.0, and D8.9 as well.
I can confirm this patch fixes my tests. Boldly marking as RTBC. Thanks @quietone!
Comment #7
quietone CreditAttribution: quietone as a volunteer commented@mparker17, thanks.
Comment #8
larowlanit looks like we declare declared twice?
Comment #9
quietone CreditAttribution: quietone as a volunteer commentedOh fudge, silly me.
Comment #10
mparker17Re-RTBC! :D
Comment #13
catchRestoring status after HEAD was broken.
Comment #14
larowlanI went to commit this, but after looking at the patch applied locally (with more context than the patch here shows) I think we can optimise this even more.
Rather than send it back for those changes, I just made them locally.
Does this look good to you @quietone @mparker17?
I realise 14 comments and multiple patches is a lot of churn for such a small change, but as the saying goes, its Drupal, if it's worth doing, it's worth overdoing.
Comment #15
quietone CreditAttribution: quietone as a volunteer commentedI applied the patch locally and immediately said to myself "Oh, that looks better!". This is a nice improvement and it fixes the problem stated in the IS. RTBC +1.
Now do I set it back to RTBC or not? Let's wait awhile and see if someone else chimes in.
Comment #17
larowlanBecause this is such a trivial patch, and my change was accepted by quietone, I'm going to go outside the normal process and commit this instead of holding it up longer. I've already pushed back twice on a one line patch.
I ummed and ahhed about just fixing it without a patch and saying 'fixed on commit' like we do for obvious coding-standards issues. But felt it was better to put up a patch and get a +1 from quietone.
Committed 40dabff and pushed to 9.3.x. Thanks!
Backported to 9.2.x
Comment #18
quietone CreditAttribution: quietone as a volunteer commented@larowlan, thank you.
Comment #19
mparker17@larowlan, @quietone, thank you both! :D