sebastianbergmann/phpunit — pull request #1279 by marcioAlmada (2014-06-05 01:02:52+00:00)
Title: Dynamic class resoltion for @expectedExceptionClass

This aims to add class resolution for `@expectedException` annotations. With this pull request, the following example should work:

```php
namespace My\Library\Deep\Namespace;

class CustomException extends \RuntimeException {}
```
```php
namespace My\Library\Deep\Namespace;

class MyDeepTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException CustomException
*/
public function testTest()
{
throw new CustomException;
}
}
```
It means that if annotated class is not absolute (begins with a namespace separator `\`) test case will try to contextualize it based on test case context (namespace). Currently, we need to use code like this to achieve the same test as above:

```php
/**
* @expectedException \My\Library\Deep\Namespace\CustomException
*/
```

I also intend to solve #730 by adding support to aliased classes, if possible to implement it sanely.

Maybe other annotations could benefit from this too: `@covers`, `@uses`, etc. But I prefer to have some feedback before add more changes.

Do you think it's worth it?