Skip to content

Commit

Permalink
Dumper::$dumpDir can be absolute path [Closes #50]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 11, 2013
1 parent 3a86887 commit f7ce813
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tester/Framework/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ public static function dumpException(\Exception $e)
*/
public static function saveOutput($testFile, $content, $suffix = '')
{
$path = dirname($testFile) . DIRECTORY_SEPARATOR . self::$dumpDir . DIRECTORY_SEPARATOR . basename($testFile, '.phpt') . $suffix;
$path = self::$dumpDir . DIRECTORY_SEPARATOR . basename($testFile, '.phpt') . $suffix;
if (!preg_match('#/|\w:#A', self::$dumpDir)) {
$path = dirname($testFile) . DIRECTORY_SEPARATOR . $path;
}
@mkdir(dirname($path)); // @ - directory may already exist
file_put_contents($path, is_string($content) ? $content : self::toPhp($content));
return $path;
Expand Down

0 comments on commit f7ce813

Please sign in to comment.