aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-09-26 08:11:47 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-10-25 07:43:49 +0200
commit4fd96d6fdee727cbb0a112e516541855d4d47feb (patch)
tree36f05ca3e175b717a3e44807011d7ad3d4529afb
parentec0c61d79580f99db258a882cdfbcb2a5e7e0e63 (diff)
downloadTest-4fd96d6fdee727cbb0a112e516541855d4d47feb.zip
Test-4fd96d6fdee727cbb0a112e516541855d4d47feb.tar.gz
Test-4fd96d6fdee727cbb0a112e516541855d4d47feb.tar.bz2
Suite: Add the `Decorrelated` interface.
If a test suite would like to be decorrelated from its System Under Test, it must implement the `Hoa\Test\Decorrelated` interface. By default, the correlation is restored. This correlation is needed for the code coverage computation.
-rw-r--r--Decorrelated.php50
-rw-r--r--Unit/Suite.php12
2 files changed, 60 insertions, 2 deletions
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/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)