} catch (Exception $e) { $t->fail('construct() accepts an instance of sfLucene'); } $t->diag('testing ->getHandlers()'); $handlers = $factory->getHandlers(); $t->is(array_keys($handlers), array('model', 'action'), '->getHandlers() returns instances of the model and action handler by default'); $t->ok($handlers['model'] == new sfLucenePropelIndexerHandler($search), '->getHandlers() returns a valid model handler'); $t->ok($handlers['action'] == new sfLuceneActionIndexerHandler($search), '->getHandlers() returns a valid action handler'); $h->get('factories')->set('indexers', array('action' => array('Foo', 'FooIndexer'))); $handlers = $factory->getHandlers(); $t->ok($handlers['action'] == new Foo($search), '->getHandlers() can overload built-in handlers'); $h->get('factories')->set('indexers', array('action' => null)); $t->is(array_keys($factory->getHandlers()), array('model'), '->getHandlers() can eliminate handlers'); $h->get('factories')->set('indexers', array('pdf' => array('Foo', 'FooIndexer'))); $handlers = $factory->getHandlers(); $t->is(array_keys($handlers), array('model', 'action', 'pdf'), '->getHandlers() can add new handlers'); $t->ok($handlers['pdf'] == new Foo($search), '->getHandlers() can add new handlers correctly'); $t->diag('testing ->getModel()'); $model = new FakeForum(); $t->isa_ok($factory->getModel($model), 'sfLucenePropelIndexer', '->getModel() returns the Propel indexer by default'); $h->get('models')->get('FakeForum')->set('indexer', 'Foo'); $t->isa_ok($factory->getModel($model), 'Foo', '->getModel() can overload the indexer on the model level'); $h->get('models')->get('FakeForum')->remove('indexer'); $h->get('factories')->set('indexers', array('model' => array('FooHandler', 'Foo'))); $t->isa_ok($factory->getModel($model), 'Foo', '->getModel() can overload the indexer on the search level'); $h->get('models')->get('FakeForum')->set('indexer', 'Bar'); $t->isa_ok($factory->getModel($model), 'Bar', '->getModel() gives higher priority to model level than search level'); $t->diag('testing ->getAction()'); $t->isa_ok($factory->getAction('foo', 'bar'), 'sfLuceneActionIndexer', '->getAction() returns the action indexer by default'); $h->get('factories')->set('indexers', array('action' => array('FooHandler', 'Foo'))); $t->isa_ok($factory->getAction('foo', 'bar'), 'Foo', '->getAction() can overload the indexer');