Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Plugin/PhpUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ protected function runConfig($directory, $configFile, $logFormat)
$cmd = $this->executable . ' %s %s';
$success = $this->builder->executeCommand($cmd, $arguments, $directory);
$output = $this->builder->getLastOutput();
$covHtmlOk = false;

if ($fileSystem->exists($this->buildLocation) &&
if ($fileSystem->exists($this->buildLocation.'/index.html') &&
$options->getOption('coverage') &&
$allowPublicArtifacts) {
$covHtmlOk = true;
$fileSystem->remove($this->buildBranchLocation);
$fileSystem->mirror($this->buildLocation, $this->buildBranchLocation);
}
Expand All @@ -210,14 +212,22 @@ protected function runConfig($directory, $configFile, $logFormat)
'lines' => !empty($matches[3]) ? $matches[3] : '0.00',
]);

if ($allowPublicArtifacts) {
if ($covHtmlOk) {
$this->builder->logSuccess(
sprintf(
"\nPHPUnit successful build coverage report.\nYou can use coverage report for this build: %s\nOr coverage report for last build in the branch: %s",
$config['url'] . '/artifacts/phpunit/' . $this->buildDirectory . '/index.html',
$config['url'] . '/artifacts/phpunit/' . $this->buildBranchDirectory . '/index.html'
)
);
} elseif ($allowPublicArtifacts) {
$this->builder->logFailure(
sprintf(
"\nPHPUnit could not build coverage report.\nmissing: %s\nlast of this branch: %s",
$config['url'] . '/artifacts/phpunit/' . $this->buildDirectory . '/index.html',
$config['url'] . '/artifacts/phpunit/' . $this->buildBranchDirectory . '/index.html'
)
);
}
}

Expand Down