/** * Run the PSR2 code sniffs on the code * * @TODO: combine with testCodeStyle * @return void */ public function testCodeStylePsr2() { $reportFile = self::$reportDir . '/phpcs_psr2_report.xml'; $wrapper = new Wrapper(); $codeSniffer = new CodeSniffer('PSR2', $reportFile, $wrapper); if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } if (version_compare($codeSniffer->version(), '1.4.7') === -1) { $this->markTestSkipped('PHP Code Sniffer Build Too Old.'); } self::setupFileLists('phpcs'); $result = $codeSniffer->run(self::$whiteList, self::$blackList, array('php')); $this->assertFileExists($reportFile, 'Expected ' . $reportFile . ' to be created by phpcs run with PSR2 standard'); $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}"); }