public function testDelete() { $this->connection->shouldReceive('getIndex')->andReturn($luceneIndex = m::mock()); $luceneIndex->shouldReceive('find')->with(m::on(function ($arg) { $term = new MultiTerm(); $term->addTerm(new Term(1, 'primary_key'), true); $term->addTerm(new Term('12345', 'class_uid'), true); $this->assertEquals($term, $arg); return true; }))->andReturnUsing(function () { $hitMock = m::mock(); $hitMock->id = 10; return [$hitMock]; }); $luceneIndex->shouldReceive('delete')->with(10)->once(); $index = $this->createIndex(); $index->delete($this->model); }
/** * Destroy the entire index. * * @return bool */ public function destroy() { $this->connection->destroy(); }
/** * Get descriptor for open index. * * @return \ZendSearch\Lucene\SearchIndexInterface */ public function index() { return $this->connection->getIndex(); }