Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| StoreTestCoverageCommand | n/a |
0 / 0 |
n/a |
0 / 0 |
5 | n/a |
0 / 0 |
|||
| getName | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| getHelpText | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| run | n/a |
0 / 0 |
n/a |
0 / 0 |
3 | |||||
| 1 | <?php |
| 2 | namespace Apie\FtpServer\SiteCommands; |
| 3 | |
| 4 | use Apie\Core\Context\ApieContext; |
| 5 | use React\Socket\ConnectionInterface; |
| 6 | use SebastianBergmann\CodeCoverage\CodeCoverage; |
| 7 | use SebastianBergmann\CodeCoverage\Report\PHP as PhpReport; |
| 8 | |
| 9 | /** |
| 10 | * @codeCoverageIgnore |
| 11 | */ |
| 12 | class StoreTestCoverageCommand implements SiteCommandInterface |
| 13 | { |
| 14 | public function getName(): string |
| 15 | { |
| 16 | return 'TEST'; |
| 17 | } |
| 18 | |
| 19 | public function getHelpText(): string |
| 20 | { |
| 21 | return 'Stores the test coverage data sent by the client (tests only).'; |
| 22 | } |
| 23 | |
| 24 | public function run(ApieContext $apieContext, string $arg = ''): ApieContext |
| 25 | { |
| 26 | $conn = $apieContext->getContext(ConnectionInterface::class); |
| 27 | if (!$arg) { |
| 28 | $conn->write("501 No file path provided for coverage data\r\n"); |
| 29 | return $apieContext; |
| 30 | } |
| 31 | $coverage = $apieContext->getContext(CodeCoverage::class, false); |
| 32 | if ($coverage instanceof CodeCoverage) { |
| 33 | $coverage->stop(); |
| 34 | (new PhpReport)->process($coverage, $arg); |
| 35 | $conn->write("200 Test coverage data stored successfully\r\n"); |
| 36 | } else { |
| 37 | $conn->write("200 No test coverage data to store\r\n"); |
| 38 | //$conn->write("550 No code coverage context available\r\n"); |
| 39 | } |
| 40 | return $apieContext; |
| 41 | } |
| 42 | } |