| 1 | <?php |
||
| 5 | trait RemoteCoverageTrait |
||
| 6 | { |
||
| 7 | |||
| 8 | public function appendRemoteCoverage() |
||
| 9 | { |
||
| 10 | foreach ($this->getRemoteCoverageFiles() as $coverageFile) { |
||
| 11 | $this->getTestResultObject()->getCodeCoverage()->append(include $coverageFile); |
||
| 12 | unlink($coverageFile); |
||
| 13 | } |
||
| 14 | } |
||
| 15 | |||
| 16 | public function generateRemoteCoverageFile() |
||
| 17 | { |
||
| 18 | return tempnam(storagePath('remote-coverage'), 'cov-' . time() . '-'); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function getRemoteCoverageFiles() |
||
| 22 | { |
||
| 23 | return glob(storagePath('remote-coverage/cov-*')); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return \PHPUnit\Framework\TestResult |
||
| 28 | */ |
||
| 29 | abstract public function getTestResultObject(); |
||
| 30 | |||
| 31 | public function writeRemoteCoverage() |
||
| 32 | { |
||
| 33 | $coverage = $this->getTestResultObject()->getCodeCoverage(); |
||
| 45 | } |
||
| 46 |