<?php use mageekguy\atoum\reports; use mageekguy\atoum\writers\std; $script->addDefaultReport(); $script->enableBranchAndPathCoverage(); $coverage = new reports\coverage\html(); $coverage->addWriter(new std\out()); $coverage->setOutPutDirectory('tests/coverage'); $runner->addReport($coverage); $telemetry = new reports\telemetry(); $telemetry->setProjectName('blackprism/serializer'); $telemetry->addWriter(new std\out()); $runner->addReport($telemetry);
public function execute() { $report = $this->configureDefaultReport(); $runner = $this->getRunner(); $runner->addReport($report); if ($this->phpPath !== null) { $this->runner->setPhpPath($this->phpPath); } if ($this->bootstrap !== null) { $this->runner->setBootstrapFile($this->bootstrap); } if ($this->maxChildren > 0) { $this->runner->setMaxChildrenNumber($this->maxChildren); } if ($this->codeCoverageEnabled() === false) { $this->runner->disableCodeCoverage(); } else { $this->runner->enableCodeCoverage(); if ($this->branchAndPathCoverageEnabled() === true) { $this->runner->enableBranchesAndPathsCoverage(); } if (($path = $this->codeCoverageCloverPath) !== null) { $clover = new atoum\reports\asynchronous\clover(); $this->runner->addReport($this->configureAsynchronousReport($clover, $path)); } $coverageReportUrl = null; if (($path = $this->codeCoverageReportPath) !== null) { $coverageHtmlField = new coverage\html(isset($this->project) === true ? $this->project->getName() : 'Code coverage report', $path); $coverageHtmlField->setRootUrl($this->codeCoverageReportUrl ?: 'file://' . $path . '/index.html'); $report->addField($coverageHtmlField); } if (($path = $this->codeCoverageReportExtensionPath) !== null) { $coverage = new reports\coverage\html(); $coverage->addWriter(new atoum\writers\std\out()); $coverage->setOutPutDirectory($path); $this->runner->addReport($coverage); } if (($path = $this->codeCoverageTreemapPath) !== null) { $report->addField($this->configureCoverageTreemapField($path, $coverageReportUrl)); } } if ($this->telemetryEnabled()) { if (class_exists('mageekguy\\atoum\\reports\\telemetry') === false) { throw new exception('AtoumTask depends on atoum/reports-extension being installed to enable telemetry report'); } $telemetry = new reports\telemetry(); $telemetry->addWriter(new atoum\writers\std\out()); if ($this->getTelemetryProjectName() !== null) { $telemetry->setProjectName($this->getTelemetryProjectName()); } $runner->addReport($telemetry); } if (($path = $this->codeCoverageXunitPath) !== null) { $xUnit = new atoum\reports\asynchronous\xunit(); $this->runner->addReport($this->configureAsynchronousReport($xUnit, $path)); } $score = $this->runner->run(); $failures = $score->getUncompletedMethodNumber() + $score->getFailNumber() + $score->getErrorNumber() + $score->getExceptionNumber() + $score->getRuntimeExceptionNumber(); if ($failures > 0) { throw new BuildException("Tests did not pass"); } return $this; }