Skip to content

Commit

Permalink
Fix #1437: Risky test messages mask failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthejeff committed Sep 17, 2014
1 parent eb0d227 commit 9cde063
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,13 @@ public function runBare()
}
}

$this->stopOutputBuffering();
try {
$this->stopOutputBuffering();
} catch (PHPUnit_Framework_RiskyTestError $_e) {
if (!isset($e)) {
$e = $_e;
}
}

// Clean up stat cache.
clearstatcache();
Expand Down
28 changes: 28 additions & 0 deletions tests/Regression/GitHub/1437.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
GH-1437: Risky test messages mask failures
--FILE--
<?php

$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = 'Issue1437Test';
$_SERVER['argv'][3] = dirname(__FILE__).'/1437/Issue1437Test.php';

require __DIR__ . '/../../bootstrap.php';
PHPUnit_TextUI_Command::main();
?>
--EXPECTF--
PHPUnit %s by Sebastian Bergmann.

F

Time: %s, Memory: %sMb

There was 1 failure:

1) Issue1437Test::testFailure
Failed asserting that false is true.

%sIssue1437Test.php:%i

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
9 changes: 9 additions & 0 deletions tests/Regression/GitHub/1437/Issue1437Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
class Issue1437Test extends PHPUnit_Framework_TestCase
{
public function testFailure()
{
ob_start();
$this->assertTrue(false);
}
}

0 comments on commit 9cde063

Please sign in to comment.