-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from robiningelbrecht/add-exit-on-low-coverage-…
…per-rule Add exit on low coverage per rule
- Loading branch information
Showing
24 changed files
with
394 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
|
||
class Exitter | ||
{ | ||
public function exit(int $code): void | ||
public function exit(): void | ||
{ | ||
exit($code); | ||
exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage; | ||
|
||
final class MinCoverageRule | ||
{ | ||
public const TOTAL = 'Total'; | ||
|
||
public function __construct( | ||
private readonly string $pattern, | ||
private readonly int $minCoverage, | ||
private readonly bool $exitOnLowCoverage | ||
) { | ||
if ($this->minCoverage < 0 || $this->minCoverage > 100) { | ||
throw new \RuntimeException(sprintf('MinCoverage has to be value between 0 and 100. %s given', $this->minCoverage)); | ||
} | ||
} | ||
|
||
public function getPattern(): string | ||
{ | ||
return $this->pattern; | ||
} | ||
|
||
public function getMinCoverage(): int | ||
{ | ||
return $this->minCoverage; | ||
} | ||
|
||
public function exitOnLowCoverage(): bool | ||
{ | ||
return $this->exitOnLowCoverage; | ||
} | ||
|
||
public function isTotalRule(): bool | ||
{ | ||
return MinCoverageRule::TOTAL === $this->getPattern(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.