/** @test */ public function it_can_reindex_explicitly_given_searchable_objects() { $activeRecord1 = new DummyActiveRecordModel(); $activeRecord1->test = 'test'; $activeRecord1->save(); $activeRecord2 = new DummyActiveRecordModel(); $activeRecord2->test = 'test'; $activeRecord2->save(); $indexName = $activeRecord1->getIndices()[0]; $index = $this->algoliaManager->initIndex($indexName); // Add dummy object to the index so it exists for the reindex operation. $response = $index->addObject(['dummy' => 'dummy'], 'dummy'); $index->waitTask($response['taskID']); $response = $this->algoliaManager->reindexOnly([$activeRecord1, $activeRecord2]); $index->waitTask($response[$index->indexName]['taskID']); $searchResult = $index->search('test'); $this->deleteIndex($index); $this->assertCount(2, $searchResult['hits']); }
/** @test */ public function it_can_return_indices_for_the_model() { $testModel = new DummyActiveRecordModel(); $this->assertEquals(['DummyActiveRecordModel'], $testModel->getIndices()); }