@@ -184,10 +184,12 @@ protected static function resolveCoversToReflectionObjects($coveredElement)
184
184
$ classes = array ($ className );
185
185
186
186
foreach ($ classes as $ className ) {
187
- if (!class_exists ($ className )) {
188
- throw new RuntimeException (
187
+ if (!class_exists ($ className ) &&
188
+ !interface_exists ($ className )) {
189
+ throw new PHPUnit_Framework_Exception (
189
190
sprintf (
190
- 'Trying to @cover not existing class "%s". ' ,
191
+ 'Trying to @cover not existing class or ' .
192
+ 'interface "%s". ' ,
191
193
$ className
192
194
)
193
195
);
@@ -223,9 +225,10 @@ protected static function resolveCoversToReflectionObjects($coveredElement)
223
225
$ classes = array ($ className );
224
226
225
227
foreach ($ classes as $ className ) {
226
- if (!(class_exists ($ className ) &&
228
+ if (!((class_exists ($ className ) ||
229
+ interface_exists ($ className )) &&
227
230
method_exists ($ className , $ methodName ))) {
228
- throw new RuntimeException (
231
+ throw new PHPUnit_Framework_Exception (
229
232
sprintf (
230
233
'Trying to @cover not existing method "%s::%s". ' ,
231
234
$ className ,
@@ -261,10 +264,12 @@ class_parents($coveredElement)
261
264
}
262
265
263
266
foreach ($ classes as $ className ) {
264
- if (!class_exists ($ className )) {
265
- throw new RuntimeException (
267
+ if (!class_exists ($ className ) &&
268
+ !interface_exists ($ className )) {
269
+ throw new PHPUnit_Framework_Exception (
266
270
sprintf (
267
- 'Trying to @cover not existing class "%s". ' ,
271
+ 'Trying to @cover not existing class or ' .
272
+ 'interface "%s". ' ,
268
273
$ className
269
274
)
270
275
);
0 commit comments