Installs a temporary error handler that will convert regular errors to
exceptions in order to make both errors and exceptions be handled
in a unified way. ErrorExceptions created like this, will get the
error's code as their severity. As this comes closest to their meaning.
The error handler honors the PHP error_level and will not convert errors
to exceptions if they are masked by the error_level. This allows test
methods to run assertions against i.e. deprecated functions. Usually
the error_level is set by the test runner so that all errors are converted.
public run ( array $options = [] ) : array | ||
$options | array | The options to use when running the test. Available options are: - `'methods'`: An arbitrary array of method names to execute. If unspecified, all methods starting with 'test' are run. - `'reporter'`: A closure which gets called after each test result, which may modify the results presented. - `'handler'`: A closure which gets registered as the temporary error handler. |
return | array |
/** * This hack is a necessary optimization until these tests are properly mocked out. * * @param array $options Options for the parent class' method. */ public function run(array $options = array()) { $this->_results = array(); try { $this->skip(); } catch (Exception $e) { $this->_handleException($e); return $this->_results; } $this->_configs = Connections::config(); $result = parent::run($options); Connections::get('lithium_mongo_test')->dropDB('lithium_test'); Connections::reset(); Connections::config($this->_configs); return $result; }