|
@@ 209-222 (lines=14) @@
|
| 206 |
|
$this->assertTrue($result->wasSuccessful()); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
public function testExceptionWithWrongMessage() |
| 210 |
|
{ |
| 211 |
|
$test = new ThrowExceptionTestCase('test'); |
| 212 |
|
$test->setExpectedException('RuntimeException', 'A logic error occurred'); |
| 213 |
|
|
| 214 |
|
$result = $test->run(); |
| 215 |
|
|
| 216 |
|
$this->assertEquals(1, $result->failureCount()); |
| 217 |
|
$this->assertEquals(1, count($result)); |
| 218 |
|
$this->assertEquals( |
| 219 |
|
"Failed asserting that exception message 'A runtime error occurred' contains 'A logic error occurred'.", |
| 220 |
|
$test->getStatusMessage() |
| 221 |
|
); |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
public function testExceptionWithRegexpMessage() |
| 225 |
|
{ |
|
@@ 235-248 (lines=14) @@
|
| 232 |
|
$this->assertTrue($result->wasSuccessful()); |
| 233 |
|
} |
| 234 |
|
|
| 235 |
|
public function testExceptionWithWrongRegexpMessage() |
| 236 |
|
{ |
| 237 |
|
$test = new ThrowExceptionTestCase('test'); |
| 238 |
|
$test->setExpectedExceptionRegExp('RuntimeException', '/logic .*? occurred/'); |
| 239 |
|
|
| 240 |
|
$result = $test->run(); |
| 241 |
|
|
| 242 |
|
$this->assertEquals(1, $result->failureCount()); |
| 243 |
|
$this->assertEquals(1, count($result)); |
| 244 |
|
$this->assertEquals( |
| 245 |
|
"Failed asserting that exception message 'A runtime error occurred' matches '/logic .*? occurred/'.", |
| 246 |
|
$test->getStatusMessage() |
| 247 |
|
); |
| 248 |
|
} |
| 249 |
|
|
| 250 |
|
/** |
| 251 |
|
* @covers PHPUnit_Framework_Constraint_ExceptionMessageRegExp |