Concurrency Tests - Update ExternalBatch for symfony/proces v4.1+
authorTim Otten <totten@civicrm.org>
Tue, 15 Aug 2023 00:01:20 +0000 (17:01 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 15 Aug 2023 00:13:05 +0000 (17:13 -0700)
Before
------

`api_v3_JobProcessMailingTest::testConcurrency()` and `Civi\FlexMailer\ConcurrencyTest`
fail when executed on Drupal 10.

After
-----

Pass when executed on Drupal 10

Technical Details
-----------------

`symfony/process` v4.1 deprecated the usage of `new Process(string)` and
added `Process::fromShellCommandline(string)`. The `new Process(string)` was
dropped from v5.x and v6.x. So you get an unconditional failure on D10. (On
other platforms, it can also fail... depending on how you deal with
deprecations.)

In `civicrm-core:composer.json`, the minimum mversion of `symfony/process` is `4.4`.
So that means we can use the newer `Process::fromShellCommandline(string)`.

Civi/API/ExternalBatch.php

index f9ea3ae69cf271ebb7c66429998fce78fe170722..5a883950763a8a330f932ae766c4b9b75ef9ad9c 100644 (file)
@@ -217,7 +217,7 @@ class ExternalBatch {
     $env = array_merge($this->env, [
       'CIVICRM_SETTINGS' => $this->settingsPath,
     ]);
-    return new Process($command, $this->root, $env);
+    return Process::fromShellCommandline($command, $this->root, $env);
   }
 
   /**