$t->fail('::getConfig() returns the $config variable in the search.yml file'); } $cswap->restore(); $t->diag('testing ->getCategoriesHarness()'); $cats = $lucene->getCategoriesHarness(); $t->isa_ok($cats, 'sfLuceneCategories', '->getCategories() returns an instance of sfLuceneCategories'); $t->ok($lucene->getCategoriesHarness() === $cats, '->getCategories() is a singleton'); $t->diag('testing ->getIndexerFactory()'); $indexer = $lucene->getIndexerFactory(); $t->isa_ok($indexer, 'sfLuceneIndexerFactory', '->getIndexer() returns an instance of sfLuceneIndexerFactory'); $t->diag('testing ->getContext()'); $t->isa_ok($lucene->getContext(), 'sfContext', '->getContext() returns an instance of sfContext'); $t->is($lucene->getContext(), sfContext::getInstance(), '->getContext() returns the same context'); $t->diag('testing ->configure()'); $lucene->configure(); $t->is(Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding(), 'UTF-8', '->configure() configures the query parsers encoding'); foreach (array('Text', 'TextNum', 'Utf8', 'Utf8Num') as $type) { $lucene->setParameter('analyzer', $type); $lucene->configure(); $class = 'Zend_Search_Lucene_Analysis_Analyzer_Common_' . $type; $expected = new $class(); $expected->addFilter(new sfLuceneLowerCaseFilter(true)); $expected->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords(array('and', 'the'))); $expected->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2)); $actual = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); $t->ok($actual == $expected, '->configure() configures the analyzer for ' . $type); } $lucene->setParameter('analyzer', 'foobar'); try { $lucene->configure(); $t->fail('->configure() analyzer must be of text, textnum, utf8, or utf8num');