/**
* Overrides the runTest method to add additional annotations
* @return PHPUnit_Framework_TestResult
*/
protected function runTest()
{
if (null === $this->plugin) {
throw new RuntimeException('Tests cannot be run before plugin is set');
}
// Clean the event handler... important!
$this->handler->clearEvents();
$info = $this->getAnnotations();
$event = null;
$eventArgs = array();
if (isset($info['method']['event']) && isset($info['method']['event'][0])) {
if (!is_string($info['method']['event'][0])) {
throw new InvalidArgumentException('Only one event may be specified');
}
$event = $info['method']['event'][0];
if (stristr($event, '::')) {
$event = explode('::', $event);
}
}
if (isset($info['method']['eventArg'])) {
$eventArgs = $info['method']['eventArg'];
}
if (null !== $event) {
$this->setEvent($event, $eventArgs);
}
$testResult = parent::runTest();
// Clean the event handler again... just incase this time.
$this->handler->clearEvents();
return $testResult;
}