protected function execute($arguments = array(), $options = array())
 {
     $this->standardBootstrap($arguments['application'], $options['env']);
     $remove = sfLuceneToolkit::getDirtyIndexRemains();
     if (count($remove) == 0) {
         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Nothing to do!', 'INFO'))));
     } elseif ($arguments['confirmation'] == 'delete') {
         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Delete confirmation provided.  Deleting directories now...', array('fg' => 'red', 'bold' => true)))));
         foreach ($remove as $dir) {
             sfToolkit::clearDirectory($dir);
             rmdir($dir);
             $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('dir-', $dir))));
         }
     } else {
         $messages = array($this->formatter->format('The following directories are alien and not referenced by your configuration:', 'INFO'));
         for ($c = count($remove), $x = 0; $x < $c; $x++) {
             $messages[] = '  ' . ($x + 1) . ') ' . $remove[$x];
         }
         $messages[] = '';
         $messages[] = 'These directories were ' . $this->formatter->format('not', array('fg' => 'red', 'bold' => true)) . ' deleted.  To delete these directories, please run:';
         $messages[] = '';
         $messages[] = '     ' . $this->formatter->format('symfony lucene:clean ' . $arguments['application'] . ' delete', 'INFO');
         $messages[] = '';
         $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages));
     }
 }
sfLuceneToolkit::loadZend();
$t->like_included('#/Zend/Search/Lucene/#', '::loadZend() loads Zend Search Lucene');
$t->in_include_path('Zend/Search/Lucene.php', '::loadZend() configures include path');
$t->diag('testing ::getDirtyIndexRemains()');
$luceneade->clear_sandbox();
$root = sfConfig::get('sf_data_dir') . '/index/';
// build valid indexes structure
sfLucene::getInstance('testLucene', 'en')->getLucene();
sfLucene::getInstance('testLucene', 'fr')->getLucene();
// build invalid indexes structures
file_put_contents($root . 'testLucene/en/random_file', 'r@nd()');
mkdir($root . 'testLucene/foo', 0777, true);
file_put_contents($root . 'testLucene/foo/bar', 'foo');
mkdir($root . 'badIndex/en', 0777, true);
file_put_contents($root . 'badIndex/bar', 'foo');
$dirty = sfLuceneToolkit::getDirtyIndexRemains();
$t->ok(in_array($root . 'testLucene/foo', $dirty), '::getDirtyIndexRemains() schedules valid indexes but invalid cultures for deletion');
$t->ok(in_array($root . 'badIndex', $dirty), '::getDirtyIndexRemains() schedules the entire of a bad index for deletion');
$t->ok(!in_array($root . 'testLucene', $dirty), '::getDirtyIndexRemains() did not schedule an entire valid index for deletion');
$t->ok(!in_array($root . 'testLucene/en', $dirty), '::getDirtyIndexRemains() did not schedule a valid index and valid culture for deletion');
$t->ok(!in_array($root . 'testLucene/fr', $dirty), '::getDirtyIndexRemains() did not schedule another valid index and valid culture for deletion');
$t->ok(!in_array($root . 'testLucene/en/random_file', $dirty), '::getDirtyIndexRemains() did not schedule an alien file in a valid index and valid culture for deletion');
$t->diag('testing ::getApplicationInstance');
$t->ok(sfLuceneToolkit::getApplicationInstance('en') === sfLucene::getInstance('testLucene', 'en'), '::getApplicationInstance() guesses the first index with no configuration parameter set');
sfConfig::set('app_lucene_index', 'fooLucene');
$t->ok(sfLuceneToolkit::getApplicationInstance('en') === sfLucene::getInstance('fooLucene', 'en'), '::getApplicationInstance() acknowledges manual override from app.yml');
$limeade->config()->remove('app_lucene_index');
$cswap = $app->cswap($luceneade->config_dir . '/search.yml')->write('<?php $config = array();');
try {
    $e = $t->exception('::getApplicationInstance() fails if search.yml is empty');
    sfLuceneToolkit::getApplicationInstance();