Problem/Motivation
In ::display() --
$this->assertEquals('status', $type, $message);
PHPUnit now expects a string for $message.
But when MigrateExecutable does this:
$this->message->display(
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
'@e' => $e->getMessage(),
'@file' => $e->getFile(),
'@line' => $e->getLine(),
]), 'error');
It's calling MigrateTestBase::display() -- presumably because the test class is being used as a test version of whatever handles a message.
This means that if a migration fails in a test, the real failure is obscured by a TypeError.
Steps to reproduce
Proposed resolution
In \Drupal\Tests\migrate\Kernel\MigrateTestBase::display cast $message to a string.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3552984
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 11.x
compare
- 3552984-migratetestbasedisplay-causes-a
changes, plain diff MR !14086
Comments
Comment #2
quietone commentedYes, I could replicate this. The MigrateMessageInterface defines $message as a string, maybe that should be changed.
But for the assertion we can just cast $message to a string.
Comment #3
joachim commentedI'm concerned there could be other places where migrate messages are misused, but let's fix this as a novice issue.
Comment #5
u7aroThe Drupal Contribution Mentoring team is triaging issues for DrupalCon Nara 2025, and we are reserving this issue for Mentored Contribution during the event.
After November 19, this issue returns to being open to all. Thanks!
Comment #8
priyansu18 commentedComment #9
joachim commentedThanks! RTBC.
Comment #11
benjifisher@sujal kshatri:
It looks as though you accidentally added an empty commit to the 11.x branch in the issue fork. I am not sure what you were trying to do, but that commit will not have any effect on this issue. The relevant branch is
3552984-migratetestbasedisplay-causes-a.The next time you update an issue, please leave a comment explaining what you are trying to do.
Comment #12
catchCommitted/pushed to main, 11.x and 11.3.x, thanks!