Skip to content

Commit

Permalink
Bugfix/91 fixing html merger (#92)
Browse files Browse the repository at this point in the history
* Issue HTML Report Merger
- continue if html report file did not exist
- print task warning message
  • Loading branch information
vansari authored Oct 29, 2021
1 parent 13e2a48 commit ca1650e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Merger/HtmlReportMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public function run()
throw new TaskException($this, "No destination file is set. Use `->into()` method to set result HTML");
}

$this->printTaskInfo("Remove not existing HTML reports...");
foreach ($this->src as $index => $item) {
if (!file_exists($item)) {
unset($this->src[$index]);
$this->printTaskWarning(
"HTML report {$item} did not exist and was removed from merge list"
);
}
}
// Resetting keys
$this->src = array_values($this->src);

$this->printTaskInfo("Merging HTML reports into {$this->dst}");

//read first source file as main
Expand Down
1 change: 1 addition & 0 deletions tests/Merger/HtmlReportMergerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function testRun(): void
$task
->from(
[
$reportPath . 'report_0.html', // this file did not exists and it should not fail
$reportPath . 'report_1.html',
$reportPath . 'report_2.html',
$reportPath . 'report_3.html',
Expand Down

0 comments on commit ca1650e

Please sign in to comment.