Exemplo n.º 1
0
<?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);
Exemplo n.º 2
0
<?php

use mageekguy\atoum\reports;
use mageekguy\atoum\writers\std;
use mageekguy\atoum\reports\coverage;
$coverage = new coverage\html();
$coverage->addWriter(new \mageekguy\atoum\writers\std\out());
$coverage->setOutPutDirectory(__DIR__ . '/coverage');
$telemetry = new reports\telemetry();
$telemetry->addWriter(new std\out());
$telemetry->readProjectNameFromComposerJson(__DIR__ . DIRECTORY_SEPARATOR . 'composer.json');
$runner->addExtension(new reports\extension($script))->addReport($coverage)->enableBranchesAndPathsCoverage()->addReport($telemetry);
$script->addTestsFromDirectory(__DIR__ . '/tests/units')->addDefaultReport();
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
<?php

require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoloader.php';
use mageekguy\atoum\reports, mageekguy\atoum\reports\coverage;
$runner->addExtension(new reports\extension($script));
$script->addDefaultReport();
$coverage = new coverage\html();
$coverage->addWriter(new \mageekguy\atoum\writers\std\out());
$coverage->setOutPutDirectory(__DIR__ . '/coverage');
$runner->addReport($coverage);
$script->enableBranchAndPAthCoverage();
$script->noCodeCoverageForClasses('mageekguy\\atoum\\reports\\asynchronous');
$script->noCodeCoverageForClasses('mageekguy\\atoum\\report');