Skip to content

Running feature tests in a separate process in PHP 8.3 fails #49593

Closed
@PHLAK

Description

@PHLAK

Laravel Version

10.39.0

PHP Version

8.3.1

Database Driver & Version

No response

Description

Running a feature test with the RunInSeparateProcess attribute (or @runInSeparateProcess annotation) on PHP 8.3 fails immediately.

Steps To Reproduce

Create a feature test that uses the RunInSeparateProcess attribute (or @runInSeparateProcess annotation).

namespace Tests\Feature;

use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

class ExampleTest extends TestCase
{
    #[Test, RunInSeparateProcess]
    public function it_can_run_in_a_separate_process(): void
    {
        $this->assertTrue(true);
    }
}

Run the test.

$ artisan test tests/Feature/ExampleTest.php

   FAIL  Tests\Feature\ExampleTest
  ⨯ it can run in a separate process                                                                                                     3199.78s  
  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\ExampleTest > it can run in a separate process                                                     AssertionFailedError   
  Test was run in child process and ended unexpectedly

NOTE: The above does not fail on PHP 8.2 and the following unit test does not fail on PHP 8.3.

namespace Tests\Unit;

use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
{
    #[Test, RunInSeparateProcess]
    public function it_can_run_in_a_separate_process(): void
    {
        $this->assertTrue(true);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions