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