protected function doRun() { if (sizeof($this->getReports()) === 0) { $this->addDefaultReport(); } switch ($this->reportFormat) { case 'xml': case 'clover': $writer = new atoum\writers\file($this->reportOutputPathIsSet()->reportOutputPath); $report = new atoum\reports\asynchronous\clover(); $this->addReport($report->addWriter($writer)); break; case 'html': $field = new atoum\report\fields\runner\coverage\html('Code coverage', $this->reportOutputPathIsSet()->reportOutputPath); $field->setRootUrl('file://' . realpath(rtrim($this->reportOutputPathIsSet()->reportOutputPath, DIRECTORY_SEPARATOR)) . '/index.html'); current($this->getReports())->addField($field); break; case 'treemap': $field = new atoum\report\fields\runner\coverage\treemap('Code coverage treemap', $this->reportOutputPathIsSet()->reportOutputPath); $field->setTreemapUrl('file://' . realpath(rtrim($this->reportOutputPathIsSet()->reportOutputPath, DIRECTORY_SEPARATOR)) . '/index.html'); current($this->getReports())->addField($field); break; default: throw new exceptions\logic\invalidArgument('Invalid format for coverage report'); } return parent::doRun(); }
Use it to configure atoum or anything that needs to be done before EACH run. More information on documentation: [en] http://docs.atoum.org/en/chapter3.html#Configuration-files [fr] http://docs.atoum.org/fr/chapter3.html#Fichier-de-configuration */ use mageekguy\atoum; $report = $script->addDefaultReport(); // This will add the atoum logo before each run. //$report->addField(new atoum\report\fields\runner\atoum\logo()); // This will add a green or red logo after each run depending on its status. $report->addField(new atoum\report\fields\runner\result\logo()); // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. if (!is_dir(__DIR__ . '/coverage')) { mkdir(__DIR__ . '/coverage'); } /* * Html coverage */ $html = new atoum\report\fields\runner\coverage\html('DbUser', __DIR__ . '/coverage'); $report->addField($html); /* * Clover coverage */ $cloverWriter = new \mageekguy\atoum\writers\file(__DIR__ . '/coverage/clover.xml'); $cloverReport = new atoum\reports\asynchronous\clover(); $cloverReport->addWriter($cloverWriter); $runner->addReport($cloverReport); // Chargement du fichier bootstrap $runner->setBootstrapFile(dirname(__FILE__) . '/.bootstrap.atoum.php');
public function testSetPackage() { $this->if($report = new testedClass())->then->object($report->setPackage($package = uniqid()))->isIdenticalTo($report)->string($report->getPackage())->isEqualTo($package); }