소스 검색

[FrameworkBundle] Updated kernel test to create tmp directory on instantiation

Brandon Turner 15 년 전
부모
커밋
84446fe0ec
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      src/Symfony/Bundle/FrameworkBundle/Tests/Kernel.php

+ 7 - 0
src/Symfony/Bundle/FrameworkBundle/Tests/Kernel.php

@@ -20,6 +20,13 @@ class Kernel extends BaseKernel
     public function __construct()
     {
         $this->tmpDir = sys_get_temp_dir().'/sf2_'.rand(1, 9999);
+        if (!is_dir($this->tmpDir)) {
+            if (false === @mkdir($this->tmpDir)) {
+                die(sprintf('Unable to create a temporary directory (%s)', $this->tmpDir));
+            }
+        } elseif (!is_writable($this->tmpDir)) {
+            die(sprintf('Unable to write in a temporary directory (%s)', $this->tmpDir));
+        }
 
         parent::__construct('env', true);
     }