Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--process-isolation causes "Test was run in child process and ended unexpectedly" #6029

Open
calbro7 opened this issue Nov 14, 2024 · 0 comments
Labels
type/bug Something is broken

Comments

@calbro7
Copy link

calbro7 commented Nov 14, 2024

Q A
PHPUnit version 9.6.15
PHP version 8.3.10
Installation Method Composer

Summary

Running with --process-isolation does not show the proper outcome of a failed test when the trace involves a closure, it displays the message "Test was run in child process and ended unexpectedly".

Current behavior

As above.

How to reproduce

Run the following:

<?php

namespace App\Tests;

use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
{
	public static function assertClosureReturnsValue(\Closure $closure, mixed $value): void
	{
		static::assertEquals($value, $closure());
	}

	public function testExample(): void
	{
        static::assertClosureReturnsValue(fn () => 1, 2);
	}
}

with phpunit --filter=ExampleTest --process-isolation

and see the outcome:

Screenshot from 2024-11-14 21-22-41

Expected behavior

It should produce the same outcome as running without --process-isolation:

Screenshot from 2024-11-14 21-23-21

@calbro7 calbro7 added the type/bug Something is broken label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant