I know this is drive-by/chiming in, but we've had this discussion with
the ZF community. While @expectedExcpetion is a feature of PHPUnit that
has been picked up and used by developers over the past few years, it
semantically makes no sense, and we have since outlawed its usage.
Why? B/c a "comment" is now affecting the outcome/execution of a code
block (in this case a unit test), ... particularly the way the PHPUnit
system interprets the outcome of this code block.
We've since removed all @expectedException "annotations" in favor of
$this->setExpectedException() call and try/catch blocks for more
specific usage. It just semantically makes more sense to our group of
developers.
On the other hand, we DO utilize the @group annotation in PHPUnit b/c it
does a fantastic job of grouping tests together. Case in point, @group
does not ever affect the running outcome of tests.
app. Example:
class FakeTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException RuntimeException
*/
public function testShouldThrowException()
{
throw new \RuntimeException('FakeTest failed.');
}
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php