Bläddra i källkod

Merge pull request #133 from mhujer/tests-lucene

Fix Lucene tests - check if the directory exists before trying to clean it up.
Frank Brückner 12 år sedan
förälder
incheckning
c227ebe8da

+ 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);