ZF-12180: Zend_Search_Lucene tests fail on second run

Description

Tests are OK during the first run, but there is probably an issue with cleaning up temporary files, so it does not work properly on second run.

PHP 5.3.8, Windows 7 64bit, PHPUnit 3.4.15


There were 9 errors:

1) Zend_Search_Lucene_LuceneTest::testCreate
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:67

2) Zend_Search_Lucene_LuceneTest::testAddDocument
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:284

3) Zend_Search_Lucene_LuceneTest::testOptimize
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:329

4) Zend_Search_Lucene_LuceneTest::testTermsStreamInterfaceSkipToTermsRetrievingZeroTermsCase
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:449

5) Zend_Search_Lucene_LuceneTest::testTermsStreamInterfaceSkipToTermsRetrievingOneTermsCase
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:474

6) Zend_Search_Lucene_LuceneTest::testTermsStreamInterfaceSkipToTermsRetrievingTwoTermsCase
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:499

7) Zend_Search_Lucene_LuceneTest::testTermsStreamInterfaceSkipToMatchedTerm
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:527

8) Zend_Search_Lucene_LuceneTest::testIsDeletedWithoutExplicitCommit
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\LuceneTest.php:561

9) Zend_Search_Lucene_DocumentTest::testHtmlInlineTagsIndexing
Zend_Search_Lucene_Exception: File 'I:\xampp\zf\tests\Zend\Search\Lucene/_index/_files/segments_2' is not readable.

I:\xampp\zf\library\Zend\Search\Lucene\Storage\File\Filesystem.php:56
I:\xampp\zf\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:359
I:\xampp\zf\library\Zend\Search\Lucene.php:551
I:\xampp\zf\library\Zend\Search\Lucene.php:211
I:\xampp\zf\tests\Zend\Search\Lucene\DocumentTest.php:202

Comments

Problem is that the directory is not cleared BEFORE each test. Fixed by adding setUp() method where the directory is cleared. Clear directory calls inside tests were removed.

Fixed in r24811.