orchestral/testbench

@runInSeparateProcess doesn't seem to work

Closed this issue · 2 comments

Hey,

I'm trying to use https://docs.phpunit.de/en/10.0/annotations.html#runinseparateprocess with the version 7.25

namespace AlexGeno\PhoneVerificationLaravel\Tests\Feature;

class RunInSeparateProcessTest extends \Orchestra\Testbench\TestCase
{

    /**
     * @runInSeparateProcess
     */
    public function test_run_in_separate_process()
    {
        $this->assertTrue(true);
    }

}

And it says

  • AlexGeno\PhoneVerificationLaravel\Tests\Feature\RunInSeparateProcessTest > run in separate process
   PHPUnit\Framework\Exception 

  Fatal error: Uncaught Error: Call to undefined method Illuminate\Container\Container::storagePath() in /package/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:890
Stack trace:
#0 /package/vendor/orchestra/testbench-core/laravel/config/cache.php(54): storage_path('framework/cache...')
#1 Standard input code(599): require_once('/package/vendor...')
#2 {main}
  thrown in /package/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 890

Without @runInSeparateProcess everything works fine.

I don't believe this is supported by Laravel Framework: laravel/framework#26372

The responsibility of this package is to bootstrap Illuminate\Foundation\Application using a basic skeleton and the above error specifically related to Laravel Framework code.

Thanks. Just for those who will run into this issue: adding @preserveGlobalState disabled helped me:

class RunInSeparateProcessTest extends \Orchestra\Testbench\TestCase
{

    /**
     * @runInSeparateProcess
     * @preserveGlobalState disabled
     */
    public function test_run_in_separate_process()
    {
        $this->assertTrue(true);
    }

}