forked from sebastianbergmann/phpunit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue sebastianbergmann#2724 - fix @runClassInSeparateProcess not wor…
…king for tests without a data provider
- Loading branch information
1 parent
4ab66ee
commit dbaf284
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
GH-2724: Missing initialization of setRunClassInSeparateProcess() for tests without data providers | ||
--FILE-- | ||
<?php | ||
|
||
$_SERVER['argv'][1] = '--no-configuration'; | ||
$_SERVER['argv'][2] = '--bootstrap'; | ||
$_SERVER['argv'][3] = __DIR__ . '/2724/bootstrap.php'; | ||
$_SERVER['argv'][4] = __DIR__ . '/2724/RunClassInSeparateProcessWithoutDataProviderTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
PHPUnit\TextUI\Command::main(); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
.. 2 / 2 (100%) | ||
|
||
Time: %s, Memory: %s | ||
|
||
OK (2 tests, 2 assertions) |
25 changes: 25 additions & 0 deletions
25
tests/Regression/GitHub/2724/RunClassInSeparateProcessWithoutDataProviderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
use PHPUnit\Framework\TestCase; | ||
|
||
if (false === getenv('_MAINPID')) { | ||
putenv('_MAINPID='.posix_getpid()); | ||
} | ||
|
||
/** | ||
* @runClassInSeparateProcess | ||
*/ | ||
class Issue2724_RunClassInSeparateProcessWithoutDataProviderTest extends TestCase | ||
{ | ||
public function test_without_dataProvider(){ | ||
$this->assertNotEquals((int) getenv('_MAINPID'), posix_getpid()); | ||
} | ||
public function nullDataProvider(){ | ||
return array(array(null, null, null)); | ||
} | ||
/** | ||
* @dataProvider nullDataProvider | ||
*/ | ||
public function test_with_dataProvider(){ | ||
$this->assertNotEquals((int) getenv('_MAINPID'), posix_getpid()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
require __DIR__ . '/../../../bootstrap.php'; |