public function testSetValues() { $wrapper = new CodingStandard_Tool_CodeSniffer_Wrapper(); $expected = array('some_key' => 'some_value'); $wrapper->setValues($expected); $this->assertEquals($expected, $wrapper->getCommandLineValues()); }
/** * Run tool for files cpecified * * @param array $whiteList Files/directories to be inspected * @param array $blackList Files/directories to be excluded from the inspection * @param array $extensions Array of alphanumeric strings, for example: 'php', 'xml', 'phtml', 'css'... * * @return int */ public function run(array $whiteList, array $blackList = array(), array $extensions = array()) { $whiteList = array_map(function ($item) { return str_replace('/', DIRECTORY_SEPARATOR, $item); }, $whiteList); $blackList = array_map(function ($item) { return preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $item)); }, $blackList); $this->_wrapper->checkRequirements(); $settings = $this->_wrapper->getDefaults(); $settings['files'] = $whiteList; $settings['standard'] = $this->_rulesetDir; $settings['ignored'] = $blackList; $settings['extensions'] = $extensions; $settings['reportFile'] = $this->_reportFile; $settings['warningSeverity'] = 0; $settings['reports']['checkstyle'] = null; $this->_wrapper->setValues($settings); ob_start(); $result = $this->_wrapper->process(); ob_end_clean(); return $result; }