Skip to content

Commit

Permalink
Add test for #2731
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 14, 2017
1 parent ae47d61 commit ae3fcc0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Regression/GitHub/2731.phpt
@@ -0,0 +1,26 @@
--TEST--
GH-2731: Empty exception message cannot be expected
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = 'Issue2731Test';
$_SERVER['argv'][3] = __DIR__ . '/2731/Issue2731Test.php';

require __DIR__ . '/../../bootstrap.php';

PHPUnit_TextUI_Command::main();
?>
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

F 1 / 1 (100%)

Time: %s, Memory: %s

There was 1 failure:

1) Issue2731Test::testOne
Failed asserting that exception message is empty but is 'message'.

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.
11 changes: 11 additions & 0 deletions tests/Regression/GitHub/2731/Issue2731Test.php
@@ -0,0 +1,11 @@
<?php
class Issue2731Test extends PHPUnit\Framework\TestCase
{
public function testOne()
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('');

throw new Exception('message');
}
}

0 comments on commit ae3fcc0

Please sign in to comment.