3535use Symfony \Component \Process \Exception \ProcessStartFailedException ;
3636use Symfony \Component \Process \Process ;
3737
38- use function Safe \putenv ;
39-
4038#[CoversClass(ProcessQueue::class)]
4139#[UsesClass(GithubActionOutput::class)]
4240final class ProcessQueueTest extends TestCase
4341{
4442 use ProphecyTrait;
4543
46- private string |false $ composerTestsAreRunningEnv ;
47-
4844 /**
4945 * @var ObjectProphecy<ConsoleOutputInterface>
5046 */
@@ -55,22 +51,28 @@ final class ProcessQueueTest extends TestCase
5551 */
5652 private ObjectProphecy $ errorOutput ;
5753
54+ /**
55+ * @var ObjectProphecy<GithubActionOutput>
56+ */
57+ private ObjectProphecy $ githubActionOutput ;
58+
5859 private ProcessQueue $ queue ;
5960
6061 /**
6162 * @return void
6263 */
6364 protected function setUp (): void
6465 {
65- $ this ->composerTestsAreRunningEnv = getenv ('COMPOSER_TESTS_ARE_RUNNING ' );
66- putenv ('COMPOSER_TESTS_ARE_RUNNING=1 ' );
67-
6866 $ this ->output = $ this ->prophesize (ConsoleOutputInterface::class);
6967 $ this ->errorOutput = $ this ->prophesize (OutputInterface::class);
7068 $ this ->output ->getErrorOutput ()
7169 ->willReturn ($ this ->errorOutput ->reveal ());
7270
73- $ this ->queue = new ProcessQueue (new GithubActionOutput ($ this ->output ->reveal ()));
71+ $ this ->githubActionOutput = $ this ->prophesize (GithubActionOutput::class);
72+ $ this ->githubActionOutput ->group (Argument::type ('string ' ), Argument::type (Closure::class))
73+ ->will (static fn (array $ arguments ): mixed => $ arguments [1 ]());
74+
75+ $ this ->queue = new ProcessQueue ($ this ->githubActionOutput ->reveal ());
7476 }
7577
7678 /**
@@ -388,12 +390,6 @@ public function waitWillFlushFinishedDetachedOutputWithoutWaitingForEveryProcess
388390 */
389391 protected function tearDown (): void
390392 {
391- if (false === $ this ->composerTestsAreRunningEnv ) {
392- putenv ('COMPOSER_TESTS_ARE_RUNNING ' );
393-
394- return ;
395- }
396-
397- putenv ('COMPOSER_TESTS_ARE_RUNNING= ' . $ this ->composerTestsAreRunningEnv );
393+ unset($ this ->queue );
398394 }
399395}
0 commit comments