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