forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added regression test for sebastianbergmann#1351.
- Loading branch information
Showing
3 changed files
with
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
GH-1351: Test result does not serialize test class in process isolation | ||
--FILE-- | ||
<?php | ||
|
||
$_SERVER['argv'][1] = '--no-configuration'; | ||
$_SERVER['argv'][2] = '--process-isolation'; | ||
$_SERVER['argv'][3] = 'Issue1351Test'; | ||
$_SERVER['argv'][4] = __DIR__ . '/1351/Issue1351Test.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
PHPUnit_TextUI_Command::main(); | ||
?> | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann. | ||
|
||
F.E. | ||
|
||
Time: %s, Memory: %sMb | ||
|
||
There was 1 error: | ||
|
||
1) Issue1351Test::testExceptionPre | ||
RuntimeException: Expected rethrown exception. | ||
%A | ||
Caused by | ||
LogicException: Expected exception. | ||
%A | ||
|
||
-- | ||
|
||
There was 1 failure: | ||
|
||
1) Issue1351Test::testFailurePre | ||
Expected failure. | ||
%A | ||
FAILURES! | ||
Tests: 4, Assertions: 5, Failures: 1, Errors: 1. |
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,4 @@ | ||
<?php | ||
class ChildProcessClass1351 | ||
{ | ||
} |
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,39 @@ | ||
<?php | ||
class Issue1351Test extends PHPUnit_Framework_TestCase | ||
{ | ||
protected $instance; | ||
|
||
/** | ||
* @runInSeparateProcess | ||
*/ | ||
public function testFailurePre() | ||
{ | ||
$this->instance = new ChildProcessClass1351(); | ||
$this->assertFalse(TRUE, 'Expected failure.'); | ||
} | ||
|
||
public function testFailurePost() | ||
{ | ||
$this->assertNull($this->instance); | ||
$this->assertFalse(class_exists('ChildProcessClass1351', false), 'ChildProcessClass1351 is not loaded.'); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
*/ | ||
public function testExceptionPre() | ||
{ | ||
$this->instance = new ChildProcessClass1351(); | ||
try { | ||
throw new LogicException('Expected exception.'); | ||
} catch (LogicException $e) { | ||
throw new RuntimeException('Expected rethrown exception.', 0, $e); | ||
} | ||
} | ||
|
||
public function testExceptionPost() | ||
{ | ||
$this->assertNull($this->instance); | ||
$this->assertFalse(class_exists('ChildProcessClass1351', false), 'ChildProcessClass1351 is not loaded.'); | ||
} | ||
} |