瀏覽代碼

Fix Lucene tests - check if the directory exists before trying to clean it up.

Martin Hujer 12 年之前
父節點
當前提交
210c34302f
共有 2 個文件被更改,包括 12 次插入6 次删除
  1. 4 0
      tests/Zend/Search/Lucene/.gitignore
  2. 8 6
      tests/Zend/Search/Lucene/Storage/DirectoryTest.php

+ 4 - 0
tests/Zend/Search/Lucene/.gitignore

@@ -0,0 +1,4 @@
+_index/*
+_index23Sample/*
+_indexSample/*
+Index/_source/_files/

+ 8 - 6
tests/Zend/Search/Lucene/Storage/DirectoryTest.php

@@ -39,14 +39,16 @@ class Zend_Search_Lucene_Storage_DirectoryTest extends PHPUnit_Framework_TestCas
     {
         $tempPath = dirname(__FILE__) . '/_tempFiles/_files';
 
-        // remove files from temporary direcytory
-        $dir = opendir($tempPath);
-        while (($file = readdir($dir)) !== false) {
-            if (!is_dir($tempPath . '/' . $file)) {
-                @unlink($tempPath . '/' . $file);
+        if (is_dir($tempPath)) {
+            // remove files from temporary direcytory
+            $dir = opendir($tempPath);
+            while (($file = readdir($dir)) !== false) {
+                if (!is_dir($tempPath . '/' . $file)) {
+                    @unlink($tempPath . '/' . $file);
+                }
             }
+            closedir($dir);
         }
-        closedir($dir);
 
         $directory = new Zend_Search_Lucene_Storage_Directory_Filesystem($tempPath);