Permalink
Browse files

Runner::setTempDirectory() accepts null

  • Loading branch information...
milo committed Aug 16, 2017
1 parent 721dc05 commit f2d9daedfacbd8ea3a4110cdc93a22d65b373bad
Showing with 10 additions and 8 deletions.
  1. +10 βˆ’8 src/Runner/Runner.php
@@ -80,20 +80,22 @@ public function getEnvironmentVariables()
/**
* @param string
* @param string|null
*/
public function setTempDirectory($path)
{
if (!is_dir($path) || !is_writable($path)) {
throw new \RuntimeException("Path '$path' is not a writable directory.");
}
if ($path !== null) {
if (!is_dir($path) || !is_writable($path)) {
throw new \RuntimeException("Path '$path' is not a writable directory.");
}
$tempDir = realpath($path) . DIRECTORY_SEPARATOR . 'Tester';
if (!is_dir($tempDir) && @mkdir($tempDir) === false && !is_dir($tempDir)) { // @ - directory may exist
throw new \RuntimeException("Cannot create '$tempDir' directory.");
$path = realpath($path) . DIRECTORY_SEPARATOR . 'Tester';
if (!is_dir($path) && @mkdir($path) === false && !is_dir($path)) { // @ - directory may exist
throw new \RuntimeException("Cannot create '$path' directory.");
}
}
$this->tempDir = $tempDir;
$this->tempDir = $path;
}

0 comments on commit f2d9dae

Please sign in to comment.