lithium\test\Unit::_runTestMethod()
Runs an individual test method, collecting results and catching exceptions along the way.
Parameters
-
string
$method
The name of the test method to run.
-
array
$options
Returns
mixedFilter
Executes filters applied to this class' run method.
Source
protected function _runTestMethod($method, $options) {
try {
$this->setUp();
} catch (Exception $e) {
$this->_handleException($e, __LINE__ - 2);
return $this->_results;
}
$params = compact('options', 'method');
$passed = $this->_filter(__CLASS__ . '::run', $params, function($self, $params, $chain) {
try {
$method = $params['method'];
$lineFlag = __LINE__ + 1;
$self->{$method}();
} catch (Exception $e) {
$self->invokeMethod('_handleException', array($e));
}
});
foreach ($this->_expected as $expected) {
$this->_result('fail', compact('method') + array(
'class' => get_class($this),
'message' => "Expected exception matching `{$expected}` uncaught.",
'data' => array(),
'file' => null,
'line' => null,
'assertion' => 'expectException'
));
}
$this->_expected = array();
try {
$this->tearDown();
} catch (Exception $e) {
$this->_handleException($e, __LINE__ - 2);
}
return $passed;
}