Open
Description
As previously reported in #3258, @runClassInSeparateProcess
has the same effect as @runTestsInSeparateProcesses
.
Unless I am mistaken (which I may well be), this can be proven by applying ...
diff --git a/tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php b/tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php
index c62c030be..4bbaf9c7d 100644
--- a/tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php
+++ b/tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php
@@ -46,4 +46,12 @@ public function testTestMethodIsRunInSeparateProcess(): void
$this->assertNotSame(self::INITIAL_PARENT_PROCESS_ID, self::$parentProcessId);
$this->assertNotSame(self::$processId, self::$parentProcessId);
}
+
+ /**
+ * @depends testTestMethodIsRunInSeparateProcess
+ */
+ public function testTestMethodIsRunInSameProcessAsOtherTestMethodsOfThisTestClass(): void
+ {
+ $this->assertSame(self::$processId, \getmypid());
+ }
}
... to augment an existing test:
./phpunit tests/end-to-end/regression/2724-diff-pid-from-parent-process.phpt
PHPUnit 9.6.3-21-g9da10e7e66 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.3
Configuration: /usr/local/src/phpunit/phpunit.xml
F 1 / 1 (100%)
Time: 00:00.262, Memory: 4.00 MB
There was 1 failure:
1) /usr/local/src/phpunit/tests/end-to-end/regression/2724-diff-pid-from-parent-process.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
PHPUnit 9.6.3-21-g9da10e7e66 by Sebastian Bergmann and contributors.
-. 1 / 1 (100%)
+.F 2 / 2 (100%)
Time: 00:00.156, Memory: 4.00 MB
-OK (1 test, 3 assertions)
+There was 1 failure:
+
+1) SeparateClassRunMethodInNewProcessTest::testTestMethodIsRunInSameProcessAsOtherTestMethodsOfThisTestClass
+Failed asserting that 260001 is identical to 1.
+
+/usr/local/src/phpunit/tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php:55
+
+FAILURES!
+Tests: 2, Assertions: 4, Failures: 1.
/usr/local/src/phpunit/tests/end-to-end/regression/2724-diff-pid-from-parent-process.phpt:17
/usr/local/src/phpunit/src/Framework/TestSuite.php:684
/usr/local/src/phpunit/src/TextUI/TestRunner.php:653
/usr/local/src/phpunit/src/TextUI/Command.php:144
/usr/local/src/phpunit/src/TextUI/Command.php:97
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
If I understand the above correctly, then, indeed, testTestMethodIsRunInSeparateProcess()
and testTestMethodIsRunInSameProcessAsOtherTestMethodsOfThisTestClass()
are run in two separate processes and not in a single separate process.
Activity