public function __construct($showProgress, $showCodeCoverage, $showMissingCodeCoverage, $showDuration, $showMemory, $codeCoverageReportPath, $codeCoverageReportUrl) { parent::__construct(null, null); $this->showProgress = $showProgress; $this->showCodeCoverage = $showCodeCoverage; $this->showMissingCodeCoverage = $showMissingCodeCoverage; $this->showDuration = $showDuration; $this->showMemory = $showMemory; $this->codeCoverageReportPath = $codeCoverageReportPath; $this->codeCoverageReportUrl = $codeCoverageReportUrl; $firstLevelPrompt = new prompt(PHP_EOL); $firstLevelColorizer = new colorizer('1;36'); $secondLevelPrompt = new prompt(' ', $firstLevelColorizer); $failureColorizer = new colorizer('0;31'); $failurePrompt = clone $secondLevelPrompt; $failurePrompt->setColorizer($failureColorizer); $errorColorizer = new colorizer('0;33'); $errorPrompt = clone $secondLevelPrompt; $errorPrompt->setColorizer($errorColorizer); $exceptionColorizer = new colorizer('0;35'); $exceptionPrompt = clone $secondLevelPrompt; $exceptionPrompt->setColorizer($exceptionColorizer); $this->addRunnerField(new runner\atoum\phing($firstLevelPrompt, $firstLevelColorizer), array(atoum\runner::runStart))->addRunnerField(new runner\php\path\cli($firstLevelPrompt, $firstLevelColorizer), array(atoum\runner::runStart))->addRunnerField(new runner\php\version\cli($firstLevelPrompt, $firstLevelColorizer, $secondLevelPrompt), array(atoum\runner::runStart)); if ($this->showCodeCoverage) { $this->addRunnerField(new runner\tests\coverage\phing($firstLevelPrompt, $secondLevelPrompt, new prompt(' ', $firstLevelColorizer), $firstLevelColorizer, null, null, $this->showMissingCodeCoverage), array(atoum\runner::runStop)); } if ($this->showDuration) { $this->addRunnerField(new runner\duration\phing($firstLevelPrompt, $firstLevelColorizer), array(atoum\runner::runStop)); } if ($this->showMemory) { $this->addRunnerField(new runner\tests\memory\phing($firstLevelPrompt, $firstLevelColorizer), array(atoum\runner::runStop)); } $this->addRunnerField(new runner\result\cli($firstLevelPrompt, new colorizer('0;37', '42'), new colorizer('0;37', '41')), array(atoum\runner::runStop))->addRunnerField(new runner\failures\cli($firstLevelPrompt, $failureColorizer, $failurePrompt), array(atoum\runner::runStop))->addRunnerField(new runner\outputs\cli($firstLevelPrompt, $firstLevelColorizer, $secondLevelPrompt), array(atoum\runner::runStop))->addRunnerField(new runner\errors\cli($firstLevelPrompt, $errorColorizer, $errorPrompt), array(atoum\runner::runStop))->addRunnerField(new runner\exceptions\cli($firstLevelPrompt, $exceptionColorizer, $exceptionPrompt), array(atoum\runner::runStop)); if ($this->showProgress) { $this->addTestField(new test\run\phing($firstLevelPrompt, $firstLevelColorizer), array(atoum\test::runStart))->addTestField(new test\event\phing()); if ($this->showDuration) { $this->addTestField(new test\duration\phing($secondLevelPrompt), array(atoum\test::runStop)); } if ($this->showMemory) { $this->addTestField(new test\memory\phing($secondLevelPrompt), array(atoum\test::runStop)); } } if ($this->getCodecoveragereportpath()) { $coverageField = new atoum\report\fields\runner\coverage\html('', $this->getCodecoveragereportpath()); if ($this->codeCoverageReportUrl === null) { $coverageField->setRootUrl("file:////" . realpath($this->getCodecoveragereportpath())); } else { $coverageField->setRootUrl($this->getCodecoveragereporturl()); } $this->addRunnerField($coverageField, array(atoum\runner::runStop)); } }
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(); }
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; }
* Copyright © 2007-2014 The Galette Team * * This file is part of Galette (http://galette.tuxfamily.org). * * Galette is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Galette is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Galette. If not, see <http://www.gnu.org/licenses/>. * * @category Core * @package GaletteTests * * @author Johan Cwiklinski <*****@*****.**> * @copyright 2013-2014 The Galette Team * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version * @version SVN: $Id$ * @link http://galette.tuxfamily.org * @since 2013-01-13 */ use mageekguy\atoum; $coverageField = new atoum\report\fields\runner\coverage\html('Galette', __DIR__ . '/coverage'); $coverageField->setRootUrl('file://' . realpath(__DIR__ . '/coverage/')); $script->addDefaultReport()->addField($coverageField);
<?php use mageekguy\atoum; $report = $script->addDefaultReport(); // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. $coverageField = new atoum\report\fields\runner\coverage\html('Shell Commander', 'coverage'); // Please replace in next line http://url/of/web/site by the root url of your code coverage web site. $coverageField->setRootUrl('http://test.local'); $report->addField($coverageField);
protected function build() { $this->resetFields(); $firstLevelPrompt = new prompt(PHP_EOL); $firstLevelColorizer = new colorizer('1;36'); $secondLevelPrompt = new prompt(' ', $firstLevelColorizer); $failureColorizer = new colorizer('0;31'); $failurePrompt = clone $secondLevelPrompt; $failurePrompt->setColorizer($failureColorizer); $errorColorizer = new colorizer('0;33'); $errorPrompt = clone $secondLevelPrompt; $errorPrompt->setColorizer($errorColorizer); $exceptionColorizer = new colorizer('0;35'); $exceptionPrompt = clone $secondLevelPrompt; $exceptionPrompt->setColorizer($exceptionColorizer); $uncompletedTestColorizer = new colorizer('0;37'); $uncompletedTestMethodPrompt = clone $secondLevelPrompt; $uncompletedTestMethodPrompt->setColorizer($uncompletedTestColorizer); $uncompletedTestOutputPrompt = new prompt(' ', $uncompletedTestColorizer); $voidTestColorizer = new colorizer('0;34'); $voidTestMethodPrompt = clone $secondLevelPrompt; $voidTestMethodPrompt->setColorizer($voidTestColorizer); $skippedTestColorizer = new colorizer('0;90'); $skippedTestMethodPrompt = clone $secondLevelPrompt; $skippedTestMethodPrompt->setColorizer($skippedTestColorizer); $phpPathField = new runner\php\path\cli(); $phpPathField->setPrompt($firstLevelPrompt)->setTitleColorizer($firstLevelColorizer); $this->addField($phpPathField); $phpVersionField = new runner\php\version\cli(); $phpVersionField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($firstLevelColorizer)->setVersionPrompt($secondLevelPrompt); $this->addField($phpVersionField); if ($this->showDuration === true) { $runnerDurationField = new runner\duration\cli(); $runnerDurationField->setPrompt($firstLevelPrompt)->setTitleColorizer($firstLevelColorizer); $this->addField($runnerDurationField); } if ($this->showMemory === true) { $runnerTestsMemoryField = new runner\tests\memory\phing(); $runnerTestsMemoryField->setPrompt($firstLevelPrompt)->setTitleColorizer($firstLevelColorizer); $this->addField($runnerTestsMemoryField); } if ($this->showCodeCoverage === true) { $runnerTestsCoverageField = new runner\tests\coverage\phing(); $runnerTestsCoverageField->setTitlePrompt($firstLevelPrompt)->setClassPrompt($secondLevelPrompt)->setMethodPrompt(new prompt(' ', $firstLevelColorizer))->setTitleColorizer($firstLevelColorizer); if ($this->showMissingCodeCoverage === false) { $runnerTestsCoverageField->hideMissingCodeCoverage(); } $this->addField($runnerTestsCoverageField); } $resultField = new runner\result\cli(); $resultField->setPrompt($firstLevelPrompt)->setSuccessColorizer(new colorizer('0;37', '42'))->setFailureColorizer(new colorizer('0;37', '41')); $this->addField($resultField); $failuresField = new runner\failures\cli(); $failuresField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($failureColorizer)->setMethodPrompt($failurePrompt); $this->addField($failuresField); $outputsField = new runner\outputs\cli(); $outputsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($firstLevelColorizer)->setMethodPrompt($secondLevelPrompt); $this->addField($outputsField); $errorsField = new runner\errors\cli(); $errorsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($errorColorizer)->setMethodPrompt($errorPrompt); $this->addField($errorsField); $exceptionsField = new runner\exceptions\cli(); $exceptionsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($exceptionColorizer)->setMethodPrompt($exceptionPrompt); $this->addField($exceptionsField); $runnerUncompletedField = new runner\tests\uncompleted\cli(); $runnerUncompletedField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($uncompletedTestColorizer)->setMethodPrompt($uncompletedTestMethodPrompt)->setOutputPrompt($uncompletedTestOutputPrompt); $this->addField($runnerUncompletedField); $runnerVoidField = new runner\tests\void\cli(); $runnerVoidField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($voidTestColorizer)->setMethodPrompt($voidTestMethodPrompt); $this->addField($runnerVoidField); $runnerSkippedField = new runner\tests\skipped\cli(); $runnerSkippedField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($skippedTestColorizer)->setMethodPrompt($skippedTestMethodPrompt); $this->addField($runnerSkippedField); if ($this->showProgress === true) { $runField = new test\run\phing(); $runField->setPrompt($firstLevelPrompt)->setColorizer($firstLevelColorizer); $this->addField($runField)->addField(new test\event\phing()); } if ($this->showDuration === true) { $durationField = new test\duration\phing(); $durationField->setPrompt($secondLevelPrompt); $this->addField($durationField); } if ($this->showMemory === true) { $memoryField = new test\memory\phing(); $memoryField->setPrompt($secondLevelPrompt); $this->addField($memoryField); } if ($this->codeCoverageReportPath !== null) { $coverageField = new atoum\report\fields\runner\coverage\html($this->codeCoverageReportProjectName ?: '', $this->codeCoverageReportPath); $coverageField->setRootUrl($this->codeCoverageReportUrl ?: 'file:////' . realpath($this->codeCoverageReportPath)); $this->addField($coverageField); } return $this; }
} } my_mkdir($path); my_mkdir($path . DIRECTORY_SEPARATOR . 'cover'); my_mkdir($path . DIRECTORY_SEPARATOR . 'treemap'); $report = $script->addDefaultReport(); $runner->setBootstrapFile(__DIR__ . DIRECTORY_SEPARATOR . '.bootstrap.atoum.php'); $runner->addTestsFromDirectory(__DIR__ . DIRECTORY_SEPARATOR . 'website' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'units' . DIRECTORY_SEPARATOR); //$script->addDefaultReport(); $xunitWriter = new atoum\writers\file('build/atoum.xunit.xml'); $xunitReport = new atoum\reports\asynchronous\xunit(); $xunitReport->addWriter($xunitWriter); $runner->addReport($xunitReport); /* Please replace in next line /path/to/destination/directory by your destination directory path for html files. */ $coverageHtmlField = new atoum\report\fields\runner\coverage\html('markattaks', 'build/atoum/cover'); /* Please replace in next line http://url/of/web/site by the root url of your code coverage web site. */ $coverageHtmlField->setRootUrl('http://m2gl.deptinfo-st.univ-fcomte.fr:9080/jenkins/job/MarkAttacks%20(w-o%20Squash%20TA)/PHP_Coverage'); // Treemap (not mandatory) /* Please replace in next line /path/to/destination/directory by your destination directory path for html files. */ $coverageTreemapField = new atoum\report\fields\runner\coverage\treemap('markattaks', 'build/atoum/treemap'); /* Please replace in next line http://url/of/treemap by the root url of your treemap web site. */ $coverageTreemapField->setTreemapUrl('http://m2gl.deptinfo-st.univ-fcomte.fr:9080/jenkins/job/MarkAttacks%20(w-o%20Squash%20TA)/PHP_Coverage_treemap')->setHtmlReportBaseUrl($coverageHtmlField->getRootUrl()); $script->addDefaultReport()->addField($coverageHtmlField)->addField($coverageTreemapField);
* @package TestsViewer * * @author Johan Cwiklinski <*****@*****.**> * @copyright 2013 Anaphore * @license Unknown http://unknown.com * @link http://anaphore.eu */ use mageekguy\atoum; $tests_dir = __DIR__ . '/../../tests-results/'; $coverage_dir = $tests_dir . 'code-coverage/'; if (!file_exists($tests_dir)) { mkdir($tests_dir); mkdir($tests_dir . 'code-coverage'); } $coverageHtmlField = new atoum\report\fields\runner\coverage\html('Bach Viewer', $coverage_dir); $coverageHtmlField->setRootUrl('file://' . realpath($coverage_dir)); $xunitWriter = new atoum\writers\file($tests_dir . '/atoum.xunit.xml'); $cloverWriter = new atoum\writers\file($tests_dir . '/clover.xml'); //Not relevant for now /*$coverageTreemapField = new atoum\report\fields\runner\coverage\treemap( 'Bach Viewer', __DIR__ . '/../treemap' ); $coverageTreemapField ->setTreemapUrl('file://' . realpath(__DIR__ . '/../treemap')) ->setHtmlReportBaseUrl($coverageHtmlField->getRootUrl());*/ $xunitReport = new atoum\reports\asynchronous\xunit(); $xunitReport->addWriter($xunitWriter); $clover = new atoum\reports\asynchronous\clover(); $clover->addWriter($cloverWriter); $cliReport = $script->addDefaultReport();
<?php # -- BEGIN LICENSE BLOCK --------------------------------------- # # This file is part of Dotclear 2. # # Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear # Licensed under the GPL version 2.0 license. # See LICENSE file or # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # # -- END LICENSE BLOCK ----------------------------------------- use mageekguy\atoum; // Write all on stdout. $stdOutWriter = new atoum\writers\std\out(); // Generate a CLI report. $cliReport = new atoum\reports\realtime\cli(); $cliReport->addWriter($stdOutWriter); // Coverage $coverageField = new atoum\report\fields\runner\coverage\html('Clearbricks', '/var/www/coverage/dotclear'); $coverageField->setRootUrl('http://localhost/coverage/dotclear'); $cliReport->addField($coverageField); $runner->addReport($cliReport);
/* LOGO */ // 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()); /**/ /* CODE COVERAGE SETUP */ if (!file_exists('/home/travis')) { // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. $coverageField = new atoum\report\fields\runner\coverage\html('BFWSql Alone', '/home/bubu-blog/www/atoum/bfw-sql-alone/report'); // Please replace in next line http://url/of/web/site by the root url of your code coverage web site. $coverageField->setRootUrl('http://test.bulton.fr/atoum/bfw-sql-alone/'); $report->addField($coverageField); } /**/ /* TEST GENERATOR SETUP */ $testGenerator = new atoum\test\generator(); // Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory. $testGenerator->setTestClassesDirectory(__DIR__ . '/test/classes'); // Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace. $testGenerator->setTestClassNamespace('BFWSql\\test\\unit'); // Please replace in next line "/path/to/your/classes/directory" by your classes directory. $testGenerator->setTestedClassesDirectory(__DIR__ . '/src/classes'); // Please replace in next line "your\project\namespace" by your project namespace. $testGenerator->setTestedClassNamespace('BFWSql');
/* LOGO */ // 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()); /**/ /* CODE COVERAGE SETUP */ if (!file_exists('/home/travis')) { // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. $coverageField = new atoum\report\fields\runner\coverage\html('BFW Controller', '/home/bubu-blog/www/atoum/bfw-controller/report'); // Please replace in next line http://url/of/web/site by the root url of your code coverage web site. $coverageField->setRootUrl('http://test.bulton.fr/atoum/bfw-controller/'); $report->addField($coverageField); } /**/ /* TEST GENERATOR SETUP */ $testGenerator = new atoum\test\generator(); // Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory. $testGenerator->setTestClassesDirectory(__DIR__ . '/test/classes'); // Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace. $testGenerator->setTestClassNamespace('BFWCtr\\test\\unit'); // Please replace in next line "/path/to/your/classes/directory" by your classes directory. $testGenerator->setTestedClassesDirectory(__DIR__ . '/src/classes'); // Please replace in next line "your\project\namespace" by your project namespace. $testGenerator->setTestedClassNamespace('BFWCtr');
<?php /* Sample atoum configuration file. Do "php path/to/test/file -c path/to/this/file" or "php path/to/atoum/scripts/runner.php -c path/to/this/file -f path/to/test/file" to use it. */ use mageekguy\atoum; /* This will add the default CLI report */ $stdOutWriter = new atoum\writers\std\out(); /* Xunit report */ $xunitWriter = new atoum\writers\file(__DIR__ . '/../build/report.xml'); $xunitReport = new atoum\reports\asynchronous\xunit(); $xunitReport->addWriter($xunitWriter); $runner->addReport($xunitReport); /* Code coverage rapport */ $coverageField = new atoum\report\fields\runner\coverage\html('atoum', __DIR__ . '/../build/code-coverage'); $coverageField->setRootUrl('http://localhost:8080'); $cliReport = new atoum\reports\realtime\cli(); $cliReport->addWriter($stdOutWriter)->addField($coverageField, array(atoum\runner::runStop)); $runner->addReport($cliReport);
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 (($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->codeCoverageTreemapPath) !== null) { $report->addField($this->configureCoverageTreemapField($path, $coverageReportUrl)); } } 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; }
<?php use mageekguy\atoum; define('COVERAGE_TITLE', 'MetaYaml'); define('COVERAGE_DIRECTORY', './web/coverage'); define('COVERAGE_WEB_PATH', 'http://localhost/meta-yaml/coverage'); if (false === is_dir(COVERAGE_DIRECTORY)) { mkdir(COVERAGE_DIRECTORY, 0777, true); } $script->addTestAllDirectory(__DIR__ . '/test'); $stdOutWriter = new atoum\writers\std\out(); $coverageField = new atoum\report\fields\runner\coverage\html(COVERAGE_TITLE, COVERAGE_DIRECTORY); $coverageField->setRootUrl(COVERAGE_WEB_PATH); $cliReport = new atoum\reports\realtime\cli(); $cliReport->addWriter($stdOutWriter)->addField($coverageField, array(atoum\runner::runStop)); $runner->setBootstrapFile('test/bootstrap.php'); $runner->addReport($cliReport);
/* LOGO */ // 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()); /**/ /* CODE COVERAGE SETUP */ if (!file_exists('/home/travis')) { // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. $coverageField = new atoum\report\fields\runner\coverage\html('BFW', '/home/bfw/www/reports/bfw-v2'); // Please replace in next line http://url/of/web/site by the root url of your code coverage web site. $coverageField->setRootUrl('http://bfw.test.bulton.fr/reports/bfw-v2/'); $report->addField($coverageField); } /**/ /* TEST GENERATOR SETUP */ $testGenerator = new atoum\test\generator(); // Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory. $testGenerator->setTestClassesDirectory(__DIR__ . '/test/classes'); // Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace. $testGenerator->setTestClassNamespace('BFW\\test\\unit'); // Please replace in next line "/path/to/your/classes/directory" by your classes directory. $testGenerator->setTestedClassesDirectory(__DIR__ . '/src/classes'); // Please replace in next line "your\project\namespace" by your project namespace. $testGenerator->setTestedClassNamespace('BFW');
public function testSetRootUrl() { $this->if($field = new testedClass(uniqid(), uniqid(), uniqid()))->then->object($field->setRootUrl($rootUrl = uniqid()))->isIdenticalTo($field)->string($field->getRootUrl())->isIdenticalTo($rootUrl)->object($field->setRootUrl($rootUrl = rand(1, PHP_INT_MAX)))->isIdenticalTo($field)->string($field->getRootUrl())->isIdenticalTo((string) $rootUrl)->object($field->setRootUrl(($rootUrl = uniqid()) . '/'))->isIdenticalTo($field)->string($field->getRootUrl())->isIdenticalTo($rootUrl . '/'); }
<?php use mageekguy\atoum; define('CODE_COVERAGE_ROOT', __DIR__ . DIRECTORY_SEPARATOR . 'tests/coverage'); $report = $script->addDefaultReport(); if (!file_exists(CODE_COVERAGE_ROOT) && !@mkdir(CODE_COVERAGE_ROOT)) { die('Unable to create directory "' . CODE_COVERAGE_ROOT . '".'); } $coverageField = new atoum\report\fields\runner\coverage\html(basename(__DIR__), CODE_COVERAGE_ROOT); $coverageField->setRootUrl('file://' . CODE_COVERAGE_ROOT); $report->addField($coverageField); $script->noCodeCoverageForNamespaces('atoum'); $runner->addTestsFromDirectory(__DIR__ . '/tests');
/* LOGO */ // 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()); /**/ /* CODE COVERAGE SETUP */ if (!file_exists('/home/travis')) { // Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. $coverageField = new atoum\report\fields\runner\coverage\html('BFWTemplate', '/home/bubu-blog/www/atoum/bfw-template/report'); // Please replace in next line http://url/of/web/site by the root url of your code coverage web site. $coverageField->setRootUrl('http://test.bulton.fr/atoum/bfw-template/'); $report->addField($coverageField); } /**/ /* TEST GENERATOR SETUP */ $testGenerator = new atoum\test\generator(); // Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory. $testGenerator->setTestClassesDirectory(__DIR__ . '/test/classes'); // Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace. $testGenerator->setTestClassNamespace('BFWTemplate\\test\\unit'); // Please replace in next line "/path/to/your/classes/directory" by your classes directory. $testGenerator->setTestedClassesDirectory(__DIR__ . '/src/classes'); // Please replace in next line "your\project\namespace" by your project namespace. $testGenerator->setTestedClassNamespace('BFWTemplate');
<?php use mageekguy\atoum; use mageekguy\atoum\visibility\extension as visibilityExtension; $report = $script->addDefaultReport(); $runner->addTestsFromDirectory(__DIR__ . '/tests'); $runner->addExtension(new visibilityExtension($script)); // CODE COVERAGE SETUP $coverageField = new atoum\report\fields\runner\coverage\html('WallIrc', __DIR__ . '/tests/coverage'); $coverageField->setRootUrl('file://' . __DIR__ . '/tests/coverage'); $report->addField($coverageField);
<?php /* Sample atoum configuration file to have code coverage in html format and the treemap. Do "php path/to/test/file -c path/to/this/file" or "php path/to/atoum/scripts/runner.php -c path/to/this/file -f path/to/test/file" to use it. */ use mageekguy\atoum; // HTML /* Please replace in next line /path/to/destination/directory by your destination directory path for html files. */ $coverageHtmlField = new atoum\report\fields\runner\coverage\html('Queue Client', 'codeCoverage'); /* Please replace in next line http://url/of/web/site by the root url of your code coverage web site. */ $coverageHtmlField->setRootUrl('/'); // Treemap (not mandatory) /* Please replace in next line /path/to/destination/directory by your destination directory path for html files. */ $coverageTreemapField = new atoum\report\fields\runner\coverage\treemap('Queue Client', 'codeCoverage'); /* Please replace in next line http://url/of/treemap by the root url of your treemap web site. */ $coverageTreemapField->setTreemapUrl('')->setHtmlReportBaseUrl($coverageHtmlField->getRootUrl()); $script->addDefaultReport()->addField($coverageHtmlField)->addField($coverageTreemapField); $cloverWriter = new atoum\writers\file('coverage.xml'); $cloverReport = new atoum\reports\asynchronous\clover(); $cloverReport->addWriter($cloverWriter); $runner->addReport($cloverReport);