Yaffs site version 1.1
[yaffs-website] / vendor / phpunit / phpunit / tests / Framework / Constraint / ExceptionMessageRegExpTest.php
1 <?php
2 /*
3  * This file is part of PHPUnit.
4  *
5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * @since      Class available since Release 4.3.0
13  * @covers     PHPUnit_Framework_Constraint_ExceptionMessageRegExp
14  */
15 class ExceptionMessageRegExpTest extends PHPUnit_Framework_TestCase
16 {
17     /**
18      * @expectedException \Exception
19      * @expectedExceptionMessageRegExp /^A polymorphic \w+ message/
20      */
21     public function testRegexMessage()
22     {
23         throw new Exception('A polymorphic exception message');
24     }
25
26     /**
27      * @expectedException \Exception
28      * @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i
29      */
30     public function testRegexMessageExtreme()
31     {
32         throw new Exception('A polymorphic exception message');
33     }
34
35     /**
36      * @runInSeparateProcess
37      * @requires extension xdebug
38      * @expectedException \Exception
39      * @expectedExceptionMessageRegExp #Screaming preg_match#
40      */
41     public function testMessageXdebugScreamCompatibility()
42     {
43         ini_set('xdebug.scream', '1');
44         throw new Exception('Screaming preg_match');
45     }
46
47     /**
48      * @coversNothing
49      * @expectedException \Exception variadic
50      * @expectedExceptionMessageRegExp /^A variadic \w+ message/
51      */
52     public function testSimultaneousLiteralAndRegExpExceptionMessage()
53     {
54         throw new Exception('A variadic exception message');
55     }
56 }