Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Merge [5111].

  • Loading branch information...
commit 859205dff61ad7167bb48e93094d2e20b50cebb9 1 parent c03e86c
Sebastian Bergmann authored
Showing with 30 additions and 6 deletions.
  1. +30 −6 PHPUnit/Util/Test.php
36 PHPUnit/Util/Test.php
View
@@ -299,6 +299,15 @@ private static function resolveCoversToReflectionObjects($coveredElement)
foreach ($classes as $className)
{
+ if (!class_exists($className)) {
+ throw new RuntimeException(
+ sprintf(
+ 'Trying to @cover not existing class "%s".',
+ $className
+ )
+ );
+ }
+
$class = new ReflectionClass($className);
$methods = $class->getMethods();
$inverse = isset($methodName{1}) && $methodName{1} == '!';
@@ -329,12 +338,20 @@ private static function resolveCoversToReflectionObjects($coveredElement)
$classes = array($className);
foreach ($classes as $className) {
- if (class_exists($className) &&
- method_exists($className, $methodName)) {
- $codeToCoverList[] = new ReflectionMethod(
- $className, $methodName
+ if (!(class_exists($className) &&
+ method_exists($className, $methodName))) {
+ throw new RuntimeException(
+ sprintf(
+ 'Trying to @cover not existing method "%s:%s".',
+ $className,
+ $methodName
+ )
);
}
+
+ $codeToCoverList[] = new ReflectionMethod(
+ $className, $methodName
+ );
}
}
} else {
@@ -359,9 +376,16 @@ class_parents($coveredElement)
}
foreach ($classes as $className) {
- if (class_exists($className)) {
- $codeToCoverList[] = new ReflectionClass($className);
+ if (!class_exists($className)) {
+ throw new RuntimeException(
+ sprintf(
+ 'Trying to @cover not existing class "%s".',
+ $className
+ )
+ );
}
+
+ $codeToCoverList[] = new ReflectionClass($className);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.