Our PHPCS configuration forbids PHPUnit annotations related to process isolation, and specifically @preserveGlobalState, @runTestsInSeparateProcesses, and @runInSeparateProcess. However, process isolation is necessary to test code that triggers HTTP headers without resorting to poorly-supported PHPUnit config options (T420009). The patch that forbade these annotations did not provide a rationale for doing so, except I guess for the fact that these annotations are "unusual" in that we basically don't use them anywhere. Now I am proposing that we un-forbid them, so we can use them to fix those tests.
I also found two mentions in phabricator for runInSeparateProcess:
- T196977: @runInSeparateProcess causes an infite loop preventing test from running suggests that the option can trigger an infinite loop. However, that's an old task that nobody investigated, so it's possible it might have been a local issue, or something that's otherwise been fixed in the meantime.
- T319459: Re-work Minify's testRunJsFile test to not use forbidden @runInSeparateProcess which breaks CI publishing suggests that arguments for the coverage driver aren't passed to isolated tests. I have just tried this for a random test in MW core, and I still get coverage data for isolated tests. So, assuming that the issue still exists, we can re-verify it in CI and probably find a fix directly there