3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 4.3.0
13 * @covers PHPUnit_Framework_Constraint_ExceptionMessageRegExp
15 class ExceptionMessageRegExpTest extends PHPUnit_Framework_TestCase
18 * @expectedException \Exception
19 * @expectedExceptionMessageRegExp /^A polymorphic \w+ message/
21 public function testRegexMessage()
23 throw new Exception('A polymorphic exception message');
27 * @expectedException \Exception
28 * @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i
30 public function testRegexMessageExtreme()
32 throw new Exception('A polymorphic exception message');
36 * @runInSeparateProcess
37 * @requires extension xdebug
38 * @expectedException \Exception
39 * @expectedExceptionMessageRegExp #Screaming preg_match#
41 public function testMessageXdebugScreamCompatibility()
43 ini_set('xdebug.scream', '1');
44 throw new Exception('Screaming preg_match');
49 * @expectedException \Exception variadic
50 * @expectedExceptionMessageRegExp /^A variadic \w+ message/
52 public function testSimultaneousLiteralAndRegExpExceptionMessage()
54 throw new Exception('A variadic exception message');