-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
elecena/nano
#2Description
| Q | A |
|---|---|
| PHPUnit version | 6.2.2 |
| PHP version | 7.1.6 |
| Installation Method | Composer |
The template in vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist is creating an instance of the test class with a NULL name instead of using TestSuite for that. The result of running this test is an Exception with message "PHPUnit\Framework\TestCase::$name must not be null" when the runTest() method of the test class is called.
To detect the presence of the isolated environment, i use an autoload.php which sets an environment variable containing the main process PID, if it does not exist yet.
autoload.php:
<?php
$loader = require __DIR__.'/vendor/autoload.php';
if (false === getenv('_MAINPID')) {
putenv('_MAINPID=' . posix_getpid());
}
return $loader;RunClassInSeparateProcessTest.php:
<?php
use PHPUnit\Framework\TestCase;
/**
* @runClassInSeparateProcess
*/
class RunClassInSeparateProcessTest extends TestCase {
public function nullDataProvider(){
return array(array(null, null, null));
}
/**
* @dataProvider nullDataProvider
*/
public function test_with_dataProvider(){
$this->assertNotEquals((int) getenv('_MAINPID'), posix_getpid());
}
}Metadata
Metadata
Assignees
Labels
No labels