/** * Returns a new AlgoliaManager. * * @return AlgoliaManager */ protected function createManager() { $config = $this->generateConfig(); $client = $this->algoliaFactory->make($config); $algoliaManager = new AlgoliaManager($client, $this->activeRecordFactory, $this->activeQueryChunker); $algoliaManager->setEnv($this->env); return $algoliaManager; }
/** * Deletes an Algolia index and asserts that it is successful. * * @param $index */ private function deleteIndex($index) { $deleteResult = $this->algoliaManager->deleteIndex($index->indexName); $this->assertArrayHasKey('deletedAt', $deleteResult); $this->assertArrayHasKey('taskID', $deleteResult); }
/** * Returns an new AlgoliaManager with mocked Factories. * * @param Client $client * @param null|ActiveRecordFactory $activeRecordFactory * @param null|ActiveQuery $activeQueryChunker * @param null|string $env * * @return AlgoliaManager */ private function getManager($client, $activeRecordFactory = null, $activeQueryChunker = null, $env = null) { if ($activeRecordFactory === null) { $activeRecordFactory = m::mock(ActiveRecordFactory::class); } if ($activeQueryChunker === null) { $activeQueryChunker = m::mock(ActiveQueryChunker::class); } $manager = new AlgoliaManager($client, $activeRecordFactory, $activeQueryChunker); $manager->setEnv($env); return $manager; }