Exemple #1
0
 public function testRun()
 {
     $whiteList = array('test' . rand(), 'test' . rand());
     $blackList = array('test' . rand(), 'test' . rand());
     $extensions = array('test' . rand(), 'test' . rand());
     $this->_wrapper->expects($this->once())->method('getDefaults')->will($this->returnValue(array()));
     $expectedCliEmulation = array('files' => $whiteList, 'standard' => self::RULE_SET, 'ignored' => $blackList, 'extensions' => $extensions, 'reportFile' => self::REPORT_FILE, 'warningSeverity' => 0, 'reports' => array('checkstyle' => null));
     $this->_wrapper->expects($this->once())->method('setValues')->with($this->equalTo($expectedCliEmulation));
     $this->_wrapper->expects($this->once())->method('process');
     $this->_tool->run($whiteList, $blackList, $extensions);
 }
Exemple #2
0
 public function testCodeStyle()
 {
     $reportFile = self::$_reportDir . '/phpcs_report.xml';
     $wrapper = new CodingStandard_Tool_CodeSniffer_Wrapper();
     $codeSniffer = new CodingStandard_Tool_CodeSniffer(realpath(__DIR__ . '/_files/phpcs'), $reportFile, $wrapper);
     if (!$codeSniffer->canRun()) {
         $this->markTestSkipped('PHP Code Sniffer is not installed.');
     }
     $result = $codeSniffer->run(self::$_whiteList, self::$_blackList, array('php', 'phtml'));
     $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}");
 }