Skip to content

Commit

Permalink
Bugfix/xml merger do not throw exception of missing xml (#88)
Browse files Browse the repository at this point in the history
* Issue XML Report Merger
- continue if xml report file did not exist
- print task warning message
  • Loading branch information
vansari authored Sep 16, 2021
1 parent c3d3d84 commit 16e92c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Merger/XmlReportMergerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ public function run(): void
$this->printTaskInfo("Processing $src");

$srcXml = new DOMDocument();
if (!file_exists($src)) {
throw new TaskException($this, "XML file $src does not exist");
if (!file_exists($src) || !is_readable($src)) {
$this->printTaskWarning('File did not exists or is not readable: ' . $src);
continue;
}
$loaded = $srcXml->load($src);
if (!$loaded) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Merger/XmlReportMergerTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function testMergeReports(): void
$task->setLogger(new Logger(new NullOutput()));
$task->from(TEST_PATH . '/fixtures/result1.xml')
->from(TEST_PATH . '/fixtures/result2.xml')
// This report did not exists and we should not throw an exception
->from(TEST_PATH . '/fixtures/result3.xml')
->into(TEST_PATH . '/result/merged.xml')
->run();

Expand Down

0 comments on commit 16e92c7

Please sign in to comment.