/** * Add all PHP_CodeSniffer test suites into a single test suite. * * @return PHPUnit_Framework_TestSuite */ public static function suite() { // Use a special PHP_CodeSniffer test suite so that we can // unset our autoload function after the run. $suite = new PHP_CodeSniffer_TestSuite('PHP CodeSniffer'); $suite->addTest(PHP_CodeSniffer_Core_AllTests::suite()); $suite->addTest(PHP_CodeSniffer_Standards_AllSniffs::suite()); // Unregister this here because the PEAR tester loads // all package suites before running then, so our autoloader // will cause problems for the packages included after us. spl_autoload_unregister(array('PHP_CodeSniffer', 'autoload')); return $suite; }
/** * Runs the tests and collects their result in a TestResult. * * @param PHPUnit_Framework_TestResult $result A test result. * @param mixed $filter The filter passed to each test. * * @return PHPUnit_Framework_TestResult */ public function run(PHPUnit_Framework_TestResult $result = null, $filter = false) { spl_autoload_register(array('SQLI_CodeSniffer', 'autoload')); $result = parent::run($result, $filter); spl_autoload_unregister(array('SQLI_CodeSniffer', 'autoload')); return $result; }