Skip to content

Commit c80cf7a

Browse files
Merge branch 'master' into report-refactoring
2 parents cc04cf1 + b56b8e6 commit c80cf7a

File tree

6 files changed

+74
-10
lines changed

6 files changed

+74
-10
lines changed

PHP/CodeCoverage/Autoload.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function php_codecoverage_autoload($class) {
5656
'php_codecoverage' => '/CodeCoverage.php',
5757
'php_codecoverage_driver' => '/CodeCoverage/Driver.php',
5858
'php_codecoverage_driver_xdebug' => '/CodeCoverage/Driver/Xdebug.php',
59+
'php_codecoverage_exception' => '/CodeCoverage/Exception.php',
5960
'php_codecoverage_filter' => '/CodeCoverage/Filter.php',
6061
'php_codecoverage_report_clover' => '/CodeCoverage/Report/Clover.php',
6162
'php_codecoverage_report_factory' => '/CodeCoverage/Report/Factory.php',

PHP/CodeCoverage/Exception.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* PHP_CodeCoverage
4+
*
5+
* Copyright (c) 2009-2011, Sebastian Bergmann <[email protected]>.
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
*
15+
* * Redistributions in binary form must reproduce the above copyright
16+
* notice, this list of conditions and the following disclaimer in
17+
* the documentation and/or other materials provided with the
18+
* distribution.
19+
*
20+
* * Neither the name of Sebastian Bergmann nor the names of his
21+
* contributors may be used to endorse or promote products derived
22+
* from this software without specific prior written permission.
23+
*
24+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35+
* POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
* @category PHP
38+
* @package CodeCoverage
39+
* @author Sebastian Bergmann <[email protected]>
40+
* @copyright 2009-2011 Sebastian Bergmann <[email protected]>
41+
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
42+
* @link http://github.com/sebastianbergmann/php-code-coverage
43+
* @since File available since Release 1.1.0
44+
*/
45+
46+
/**
47+
* Eyception class for PHP_CodeCoverage component.
48+
*
49+
* @category PHP
50+
* @package CodeCoverage
51+
* @author Sebastian Bergmann <[email protected]>
52+
* @copyright 2009-2011 Sebastian Bergmann <[email protected]>
53+
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
54+
* @version Release: @package_version@
55+
* @link http://github.com/sebastianbergmann/php-code-coverage
56+
* @since Class available since Release 1.1.0
57+
*/
58+
class PHP_CodeCoverage_Exception extends RuntimeException
59+
{
60+
}

PHP/CodeCoverage/Report/Node/Directory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function addDirectory($name)
201201
* @param array $coverageData
202202
* @param array $testData
203203
* @return PHP_CodeCoverage_Report_Node_File
204-
* @throws RuntimeException
204+
* @throws PHP_CodeCoverage_Exception
205205
*/
206206
public function addFile($name, array $coverageData, array $testData)
207207
{

PHP/CodeCoverage/Util.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static function crap($ccn, $coverage)
186186
/**
187187
* @param string $directory
188188
* @return string
189-
* @throws RuntimeException
189+
* @throws PHP_CodeCoverage_Exception
190190
*/
191191
public static function getDirectory($directory)
192192
{
@@ -202,7 +202,7 @@ public static function getDirectory($directory)
202202
return $directory;
203203
}
204204

205-
throw new RuntimeException(
205+
throw new PHP_CodeCoverage_Exception(
206206
sprintf(
207207
'Directory "%s" does not exist.',
208208
$directory
@@ -526,7 +526,7 @@ protected static function resolveCoversToReflectionObjects($coveredElement)
526526
foreach ($classes as $className) {
527527
if (!class_exists($className) &&
528528
!interface_exists($className)) {
529-
throw new RuntimeException(
529+
throw new PHP_CodeCoverage_Exception(
530530
sprintf(
531531
'Trying to @cover not existing class or ' .
532532
'interface "%s".',
@@ -574,7 +574,7 @@ protected static function resolveCoversToReflectionObjects($coveredElement)
574574
interface_exists($className) ||
575575
trait_exists($className)) &&
576576
method_exists($className, $methodName))) {
577-
throw new RuntimeException(
577+
throw new PHP_CodeCoverage_Exception(
578578
sprintf(
579579
'Trying to @cover not existing method "%s::%s".',
580580
$className,
@@ -614,7 +614,7 @@ class_parents($coveredElement)
614614
if (!class_exists($className) &&
615615
!interface_exists($className) &&
616616
!trait_exists($className)) {
617-
throw new RuntimeException(
617+
throw new PHP_CodeCoverage_Exception(
618618
sprintf(
619619
'Trying to @cover not existing class or ' .
620620
'interface "%s".',

Tests/PHP/CodeCoverage/UtilTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function testGetLinesToBeCovered($test, $lines)
176176
/**
177177
* @covers PHP_CodeCoverage_Util::getLinesToBeCovered
178178
* @covers PHP_CodeCoverage_Util::resolveCoversToReflectionObjects
179-
* @expectedException RuntimeException
179+
* @expectedException PHP_CodeCoverage_Exception
180180
*/
181181
public function testGetLinesToBeCovered2()
182182
{
@@ -188,7 +188,7 @@ public function testGetLinesToBeCovered2()
188188
/**
189189
* @covers PHP_CodeCoverage_Util::getLinesToBeCovered
190190
* @covers PHP_CodeCoverage_Util::resolveCoversToReflectionObjects
191-
* @expectedException RuntimeException
191+
* @expectedException PHP_CodeCoverage_Exception
192192
*/
193193
public function testGetLinesToBeCovered3()
194194
{
@@ -200,7 +200,7 @@ public function testGetLinesToBeCovered3()
200200
/**
201201
* @covers PHP_CodeCoverage_Util::getLinesToBeCovered
202202
* @covers PHP_CodeCoverage_Util::resolveCoversToReflectionObjects
203-
* @expectedException RuntimeException
203+
* @expectedException PHP_CodeCoverage_Exception
204204
*/
205205
public function testGetLinesToBeCovered4()
206206
{
@@ -342,7 +342,7 @@ public function testGetDirectory2()
342342

343343
/**
344344
* @covers PHP_CodeCoverage_Util::getDirectory
345-
* @expectedException RuntimeException
345+
* @expectedException PHP_CodeCoverage_Exception
346346
*/
347347
public function testGetDirectory3()
348348
{

package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
<file baseinstalldir="/" name="Driver.php" role="php">
8989
<tasks:replace from="@package_version@" to="version" type="package-info" />
9090
</file>
91+
<file baseinstalldir="/" name="Exception.php" role="php">
92+
<tasks:replace from="@package_version@" to="version" type="package-info" />
93+
</file>
9194
<file baseinstalldir="/" name="Filter.php" role="php">
9295
<tasks:replace from="@package_version@" to="version" type="package-info" />
9396
</file>

0 commit comments

Comments
 (0)