diff --git a/PHPUnit/Autoload.php b/PHPUnit/Autoload.php index 2cef11fc84b..b96ff937096 100644 --- a/PHPUnit/Autoload.php +++ b/PHPUnit/Autoload.php @@ -125,6 +125,7 @@ function ($class) 'phpunit_framework_expectationfailedexception' => '/Framework/ExpectationFailedException.php', 'phpunit_framework_incompletetest' => '/Framework/IncompleteTest.php', 'phpunit_framework_incompletetesterror' => '/Framework/IncompleteTestError.php', + 'phpunit_framework_invalidcoverstargeterror' => '/Framework/InvalidCoversTargetError.php', 'phpunit_framework_outputerror' => '/Framework/OutputError.php', 'phpunit_framework_selfdescribing' => '/Framework/SelfDescribing.php', 'phpunit_framework_skippedtest' => '/Framework/SkippedTest.php', diff --git a/PHPUnit/Framework/InvalidCoversTargetError.php b/PHPUnit/Framework/InvalidCoversTargetError.php new file mode 100644 index 00000000000..47cd5a8897c --- /dev/null +++ b/PHPUnit/Framework/InvalidCoversTargetError.php @@ -0,0 +1,60 @@ +. + * 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 Sebastian Bergmann nor the names of his + * 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 OWNER OR 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. + * + * @package PHPUnit + * @subpackage Framework + * @author Sebastian Bergmann + * @copyright 2001-2012 Sebastian Bergmann + * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License + * @link http://www.phpunit.de/ + * @since File available since Release 3.8.0 + */ + +/** + * Extension to PHPUnit_Framework_AssertionFailedError to mark the special + * case of a test that is skipped because of an invalid @covers annotation. + * + * @package PHPUnit + * @subpackage Framework + * @author Sebastian Bergmann + * @copyright 2001-2012 Sebastian Bergmann + * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License + * @link http://www.phpunit.de/ + * @since Class available since Release 3.8.0 + */ +class PHPUnit_Framework_InvalidCoversTargetError extends PHPUnit_Framework_AssertionFailedError implements PHPUnit_Framework_SkippedTest +{ +} diff --git a/PHPUnit/Framework/TestResult.php b/PHPUnit/Framework/TestResult.php index c738583abdd..f8c0b354a87 100644 --- a/PHPUnit/Framework/TestResult.php +++ b/PHPUnit/Framework/TestResult.php @@ -685,6 +685,16 @@ public function run(PHPUnit_Framework_Test $test) ); } + catch (PHP_CodeCoverage_Exception_InvalidCoversTarget $e) { + $this->addFailure( + $test, + new PHPUnit_Framework_InvalidCoversTargetError( + $e->getMessage() + ), + $time + ); + } + catch (PHP_CodeCoverage_Exception $cce) { $error = TRUE; diff --git a/package.xml b/package.xml index c020fe76200..82cdf5d179c 100644 --- a/package.xml +++ b/package.xml @@ -122,6 +122,7 @@ +