My phpunit test:
<?php
class TestTest extends PHPUnit_Framework_TestCase
{
/*
* @expectedExceptionMessage success
*/
public function testExceptionMessage() {
throw new Exception('success');
}
}
The unit test is failing. Here's the output of phpunit:
There was 1 error:
1) TestTest::testExceptionMessage
Exception: success
/path/to/TestTest.php:8
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
It seems to me that the test ought to be a success since the Exception message is success, which is what @expectedExceptionMessage is expecting?
@expectedException Exception
....@expectedExceptionMessage
works in conjunction with@expectedException