public function testRun() { $whiteList = ['test' . rand(), 'test' . rand()]; $extensions = ['test' . rand(), 'test' . rand()]; $this->_wrapper->expects($this->once())->method('getDefaults')->will($this->returnValue([])); $expectedCliEmulation = ['files' => $whiteList, 'standard' => [self::RULE_SET], 'extensions' => $extensions, 'reportFile' => self::REPORT_FILE, 'warningSeverity' => 0, 'reports' => ['checkstyle' => null]]; $this->_tool->setExtensions($extensions); $this->_wrapper->expects($this->once())->method('setValues')->with($this->equalTo($expectedCliEmulation)); $this->_wrapper->expects($this->once())->method('process'); $this->_tool->run($whiteList); }
/** * Run the magento specific coding standards on the code * * @return void */ public function testCodeStyle() { $reportFile = self::$reportDir . '/less_report.txt'; $wrapper = new LessWrapper(); $codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/lesscs'), $reportFile, $wrapper); if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } $codeSniffer->setExtensions([LessWrapper::LESS_FILE_EXTENSION]); $fileList = PHPCodeTest::getWhitelist([LessWrapper::LESS_FILE_EXTENSION], __DIR__, __DIR__); $result = $codeSniffer->run($this->filterFiles($fileList)); $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}"); }
/** * Run the magento specific coding standards on the code * * @return void */ public function testCodeStyle() { $reportFile = self::$reportDir . '/phpcs_report.txt'; $wrapper = new Wrapper(); $codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/phpcs'), $reportFile, $wrapper); if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } $codeSniffer->setExtensions(['php', 'phtml']); $result = $codeSniffer->run(self::getWhitelist(['php', 'phtml'])); $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); }
/** * Run the magento specific coding standards on the code * * @return void */ public function testCodeStyle() { $reportFile = self::$reportDir . '/phpcs_report.xml'; $wrapper = new Wrapper(); $codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/phpcs'), $reportFile, $wrapper); if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } $codeSniffer->setExtensions(['php', 'phtml']); $result = $codeSniffer->run(self::getWhitelist(['php', 'phtml'])); $this->assertEquals(0, $result, "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}"); }