/**
* Add all sniff unit tests into a test suite.
*
* Sniff unit tests are found by recursing through the 'Tests' directory
* of each installed coding standard.
*
* @return PHPUnit_Framework_TestSuite
*/
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('PHP CodeSniffer Standards');
$baseDir = pathinfo(getcwd() . "/Ongr", PATHINFO_DIRNAME);
\PHP_CodeSniffer::setConfigData('installed_paths', $baseDir);
$path = pathinfo(\PHP_CodeSniffer::getInstalledStandardPath('Ongr'), PATHINFO_DIRNAME);
$testsDir = $path . DIRECTORY_SEPARATOR . 'Tests' . DIRECTORY_SEPARATOR . 'Unit';
$directoryIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testsDir));
/** @var \SplFileInfo $fileinfo */
foreach ($directoryIterator as $file) {
// Skip hidden and extension must be php.
if ($file->getFilename()[0] === '.' || pathinfo($file, PATHINFO_EXTENSION) !== 'php') {
continue;
}
$className = str_replace([$baseDir . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], ['', '\\'], substr($file, 0, -4));
$suite->addTest(new $className('getErrorList'));
}
return $suite;
}