aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-10-25 11:34:43 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-10-25 11:34:43 +0200
commit43ae8ae022d706face7581512f5052ff0cc8bfd8 (patch)
tree8f7f790842caf9866a4e46c8a59fbd8eab4fc9af
parent9a92e3123ef1a82e81886c5b3ff0911b8fcaf660 (diff)
parentf61a986c720c9ae502b9a80183ddb3bfaad82cda (diff)
downloadTest-43ae8ae022d706face7581512f5052ff0cc8bfd8.zip
Test-43ae8ae022d706face7581512f5052ff0cc8bfd8.tar.gz
Test-43ae8ae022d706face7581512f5052ff0cc8bfd8.tar.bz2
Report: Add Travis and Coveralls.io support.
-rw-r--r--.atoum.php43
-rw-r--r--Decorrelated.php50
-rw-r--r--Report/Cli/Cli.php2
-rw-r--r--Unit/Suite.php12
-rw-r--r--composer.json2
5 files changed, 101 insertions, 8 deletions
diff --git a/.atoum.php b/.atoum.php
index 6da591f..988bf9f 100644
--- a/.atoum.php
+++ b/.atoum.php
@@ -1,7 +1,42 @@
<?php
-$runner->addExtension(new Atoum\PraspelExtension\Manifest());
-$runner->addExtension(new mageekguy\atoum\ruler\extension($script));
-$runner->addExtension(new mageekguy\atoum\visibility\extension($script));
-$report = new Hoa\Test\Report\Cli\Cli();
+use Atoum\PraspelExtension;
+use Hoa\Test;
+use mageekguy\atoum;
+
+/**
+ * Register extensions.
+ */
+$runner->addExtension(new PraspelExtension\Manifest());
+$runner->addExtension(new atoum\ruler\extension($script));
+$runner->addExtension(new atoum\visibility\extension($script));
+
+/**
+ * Our own report.
+ */
+$report = new Test\Report\Cli\Cli();
$runner->addReport($report->addWriter(new atoum\writers\std\out()));
+
+/**
+ * Publish code coverage report on coveralls.io from Travis.
+ */
+if (false !== getenv('TRAVIS')) {
+ $coverallsReport = new atoum\reports\asynchronous\coveralls('.');
+
+ $defaultFinder = $coverallsReport->getBranchFinder();
+ $coverallsReport
+ ->setBranchFinder(
+ function() use ($defaultFinder) {
+ if (false === $branch = getenv('TRAVIS_BRANCH')) {
+ $branch = $defaultFinder();
+ }
+
+ return $branch;
+ }
+ )
+ ->setServiceName('travis-ci')
+ ->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null)
+ ->addDefaultWriter();
+
+ $runner->addReport($coverallsReport);
+}
diff --git a/Decorrelated.php b/Decorrelated.php
new file mode 100644
index 0000000..45d99a7
--- /dev/null
+++ b/Decorrelated.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2016, Hoa community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Hoa nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+namespace Hoa\Test;
+
+/**
+ * Interface \Hoa\Test\Decorrelated.
+ *
+ * Represent a test suite where test cases are decorrelated from the System
+ * Under Test.
+ *
+ * @copyright Copyright © 2007-2016 Hoa community
+ * @license New BSD License
+ */
+interface Decorrelated
+{
+}
diff --git a/Report/Cli/Cli.php b/Report/Cli/Cli.php
index 46bcccb..e9febb9 100644
--- a/Report/Cli/Cli.php
+++ b/Report/Cli/Cli.php
@@ -104,7 +104,7 @@ class Cli extends atoum\reports\realtime
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($defaultColorizer)
->setClassPrompt($secondLevelPrompt)
- ->setMethodPrompt(new atoum\cli\prompt('==> ', $defaultColorizer));
+ ->setMethodPrompt($thirdLevelPrompt);
$this->addField($this->runnerTestsCoverageField);
diff --git a/Unit/Suite.php b/Unit/Suite.php
index be08edf..d266d50 100644
--- a/Unit/Suite.php
+++ b/Unit/Suite.php
@@ -68,12 +68,20 @@ class Suite extends atoum\test
public function getTestedClassName()
{
- return 'StdClass';
+ if ($this instanceof Test\Decorrelated) {
+ return 'StdClass';
+ }
+
+ return parent::getTestedClassName();
}
public function getTestedClassNamespace()
{
- return '\\';
+ if ($this instanceof Test\Decorrelated) {
+ return '\\';
+ }
+
+ return parent::getTestedClassNamespace();
}
public function beforeTestMethod($methodName)
diff --git a/composer.json b/composer.json
index 17a353e..0d98223 100644
--- a/composer.json
+++ b/composer.json
@@ -23,7 +23,7 @@
"source": "https://central.hoa-project.net/Resource/Library/Test"
},
"require": {
- "atoum/atoum" : "~2.8",
+ "atoum/atoum" : "~2.9.0-beta1",
"atoum/praspel-extension" : "~0.16",
"atoum/ruler-extension" : "~1.2",
"atoum/visibility-extension": "~1.0",