atoum/atoum — pull request #311 by mageekguy (2013-11-15 10:40:30+00:00)
Title: Test method prefix is now configurable with a string or a regex

Moreover, the test method prefix can be inherited from one of the parent classes.
The goal is exactly the same than the PR #286 seems to me to be incomplete (no annotation support, no annotation inheritance), so this PR is based upon it and complete it with missing functionality (thanks to @FlorianLB and @jubianchi for their work).
So, with this PR, the default test method prefix is a regex which can allow the user to write:
```php
public function testFoo() { … }
public function it_should_do_something() { … }
public function foo_should_do_something() { … }
```
The regex is case-insensitive (PHP is not case-sensitive for function name).
If the user don't wants to use the default test prefix method, there are several solutions and he can define a string or a regex as test method prefix.
Firstly, it can use the annotation `@methodPrefix` to define it at class level:
```php
/** @methodPrefix fuckingTest */
class fuckingTestClass extends \atoum
{
public function fuckingTestShouldBeGreen() { … }
}

/** @methodPrefix #^the_[^_]+_should_# */ // even it's fully functional, avoid using `/` as regex delimiter here to improve readability
class fuckingTestClass extends \atoum
{
public function the_fuckingTestedMethod_should_be_green() { … }
}
```
Secondly, the user can extends the `\atoum\test` class and define its test method prefix in its constructor:
```php
class myFuckingTest extends \atoum\test
{
public function __construct()
{
$this->setTestMethodPrefix('#^the_[^_]+_should_#');

parent::__construct(); // the parent constructor should be called AFTER setTestMethodPrefix
}
```
From now, a test class which extends from `myFuckingTest` will use the regex `'#^the_[^_]+_should_#'` as test method prefix.
Thirdly, the user can extends the `\atoum\test` class and define its test method prefix with an annotation:
```php
/** @methodPrefix #^the_[^_]+_should_# */ // even it's fully functional, avoid using `/` as regex delimiter here to improve readability
class myFuckingTest extends \atoum\test {}
```
Again, a test class which extends from `myFuckingTest` will use the regex `'#^the_[^_]+_should_#'` as test method prefix.