Skip to content

Commit 35f664e

Browse files
sebastianbergmanndas-peter
authored andcommitted
Actually use the improved error message.
1 parent 63b5cc8 commit 35f664e

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

PHPUnit/Util/Fileloader.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public static function checkAndLoad($filename, $syntaxCheck = FALSE)
8080
}
8181

8282
if (!is_readable($filename)) {
83-
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'existing file');
83+
throw new RuntimeException(
84+
sprintf('Cannot open file "%s".' . "\n", $filename)
85+
);
8486
}
8587

8688
if ($syntaxCheck) {
@@ -99,19 +101,11 @@ public static function checkAndLoad($filename, $syntaxCheck = FALSE)
99101
*/
100102
public static function load($filename)
101103
{
102-
$_filename = PHPUnit_Util_Filesystem::fileExistsInIncludePath(
104+
$filename = PHPUnit_Util_Filesystem::fileExistsInIncludePath(
103105
$filename
104106
);
105107

106-
if (!$_filename) {
107-
throw new RuntimeException(
108-
sprintf('Cannot open file "%s".' . "\n", $filename)
109-
);
110-
}
111-
112-
$filename = $_filename;
113108
$oldVariableNames = array_keys(get_defined_vars());
114-
unset($_filename);
115109

116110
include_once $filename;
117111

0 commit comments

Comments
 (0)