Beispiel #1
0
 /**
  * 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($wrapper->version(), '1.4.7') === -1) {
         $this->markTestSkipped('PHP Code Sniffer Build Too Old.');
     }
     self::setupFileLists('phpcs');
     $result = $codeSniffer->run(self::$whiteList, self::$blackList, ['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}");
 }
Beispiel #2
0
 /**
  * Run the PSR2 code sniffs on the code
  *
  * @TODO: combine with testCodeStyle
  * @return void
  */
 public function testCodeStylePsr2()
 {
     $reportFile = self::$reportDir . '/phpcs_psr2_report.txt';
     $wrapper = new Wrapper();
     $codeSniffer = new CodeSniffer('PSR2', $reportFile, $wrapper);
     if (!$codeSniffer->canRun()) {
         $this->markTestSkipped('PHP Code Sniffer is not installed.');
     }
     if (version_compare($wrapper->version(), '1.4.7') === -1) {
         $this->markTestSkipped('PHP Code Sniffer Build Too Old.');
     }
     $result = $codeSniffer->run(self::getWhitelist());
     $output = "";
     if (file_exists($reportFile)) {
         $output = file_get_contents($reportFile);
     }
     $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): " . PHP_EOL . $output);
 }
Beispiel #3
0
 /**
  * Return the version of code sniffer found
  *
  * @return string
  */
 public function version()
 {
     return $this->wrapper->version();
 }
Beispiel #4
0
 /**
  * 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($wrapper->version(), '1.4.7') === -1) {
         $this->markTestSkipped('PHP Code Sniffer Build Too Old.');
     }
     $result = $codeSniffer->run(self::getWhitelist());
     $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}");
 }