Found in #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7.

Problem/Motivation

MigrateExecutableMemoryExceededTest has mock expectation fails in PHPUnit8 due to inconsistent matches(). This is due to a string being compared to a TranslatableMarkup object within a stringContains constraint in the mock.

Proposed resolution

Change the stringContains constraint into an appropriate callback.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3102903-2.patch1.13 KBmondrake
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Needs review
FileSize
1.13 KB

Patch.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Seems reasonable. Thanks for fixing this up.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed dda035c260 to 9.0.x and da130569cb to 8.9.x and 8130c365bc to 8.8.x. Thanks!

Backported to 8.8.x as this is a test-only fix.

diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
index bce961dafa..4d80feeaa7 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
@@ -80,12 +80,12 @@ protected function runMemoryExceededTest($message, $memory_exceeded, $memory_usa
     if ($message) {
       $this->executable->message->expects($this->at(0))
         ->method('display')
-        ->with($this->callback(function($subject) {
+        ->with($this->callback(function ($subject) {
             return mb_stripos((string) $subject, 'reclaiming memory') !== FALSE;
         }));
       $this->executable->message->expects($this->at(1))
         ->method('display')
-        ->with($this->callback(function($subject) use ($message) {
+        ->with($this->callback(function ($subject) use ($message) {
             return mb_stripos((string) $subject, $message) !== FALSE;
         }));
     }

Fixed coding standards on commit.

  • alexpott committed dda035c on 9.0.x
    Issue #3102903 by mondrake: MigrateExecutableMemoryExceededTest has...

  • alexpott committed da13056 on 8.9.x
    Issue #3102903 by mondrake: MigrateExecutableMemoryExceededTest has...

  • alexpott committed 8130c36 on 8.8.x
    Issue #3102903 by mondrake: MigrateExecutableMemoryExceededTest has...

Status: Fixed » Closed (fixed)

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