Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a single phpUnit test in a separate process?

Is it possible to run a test suite of phpUnit tests in the same process, but identify specific tests to be run in their own processes?

Normally I use

@runTestsInSeparateProcesses
@preserveGlobalState disabled

for an entire test suite, but I only need a single method to be ran separately, and I'd like the speed increase of having the rest run in a single process.

Thanks

like image 833
jake_feyereisen Avatar asked Oct 10 '13 19:10

jake_feyereisen


Video Answer


1 Answers

As you can see in PHPUnit manual you can use the @runInSeparateProcess tag:

class MyTest extends PHPUnit_Framework_TestCase
{
    /**
    * @runInSeparateProcess
    */
    public function testInSeparateProcess()
    {
        // ...
    }
}
like image 148
Nelson Senna Avatar answered Oct 12 '22 23:10

Nelson Senna