/** * Returns a sorted array of the files that should be in the report. * * @return Array of CbFile */ public function getFiles() { CbFile::sort($this->_files); return $this->_files; }
/** * Test getFiles. * * @return void */ public function test__getFiles() { $expected = array('/a/nother/dir/src.php' => new CbFile('/a/nother/dir/src.php', array(new CbIssue('/a/nother/dir/src.php', 39, 39, 'Checkstyle', 'm3', 'error'), new CbIssue('/a/nother/dir/src.php', 40, 40, 'Checkstyle', 'm4', 'error'), new CbIssue('/a/nother/dir/src.php', 291, 291, 'PMD', 'descr', 'error'))), '/a/dir/source.php' => new CbFile('/a/dir/source.php', array(new CbIssue('/a/dir/source.php', 37, 37, 'Checkstyle', 'm1', 'error')))); CbFile::sort($expected); $actual = $this->_cbSourceHandler->getFiles(); $this->assertEquals($expected, $actual); }
/** * Has the file any issues? * * @param CbFile $file * @return boolean */ public static function hasFileAnyIssues(CbFile $file) { $issues = $file->getIssues(); return !empty($issues); }
/** * Test the sort function. * * @return void. */ public function test__sort() { $sorted = array(new CbFile("src/Helper/IOHelper.php"), new CbFile("src/Plugins/ErrorCPD.php"), new CbFile("src/Plugins/ErrorCheckstyle.php"), new CbFile("src/Plugins/ErrorCoverage.php"), new CbFile("src/Plugins/ErrorPMD.php"), new CbFile("src/Plugins/ErrorPadawan.php"), new CbFile("src/Util/Autoloader.php"), new CbFile("src/Util/Logger.php"), new CbFile("src/View/ViewAbstract.php"), new CbFile("src/View/ViewReview.php"), new CbFile("src/CLIController.php"), new CbFile("src/File.php"), new CbFile("src/Issue.php"), new CbFile("src/IssueXml.php"), new CbFile("src/PluginsAbstract.php"), new CbFile("src/SourceHandler.php"), new CbFile("src/SourceIterator.php")); $mixed = array(new CbFile("src/PluginsAbstract.php"), new CbFile("src/Plugins/ErrorCheckstyle.php"), new CbFile("src/CLIController.php"), new CbFile("src/Plugins/ErrorPadawan.php"), new CbFile("src/SourceIterator.php"), new CbFile("src/SourceHandler.php"), new CbFile("src/Issue.php"), new CbFile("src/View/ViewReview.php"), new CbFile("src/File.php"), new CbFile("src/Util/Autoloader.php"), new CbFile("src/Helper/IOHelper.php"), new CbFile("src/IssueXml.php"), new CbFile("src/Plugins/ErrorCoverage.php"), new CbFile("src/View/ViewAbstract.php"), new CbFile("src/Util/Logger.php"), new CbFile("src/Plugins/ErrorPMD.php"), new CbFile("src/Plugins/ErrorCPD.php")); CbFile::sort($mixed); $mixed = array_values($mixed); $this->assertEquals($sorted, $mixed); }