/** * Cleanup test workspace * * @throws Elasticsearch\Common\Exceptions\Missing404Exception * @throws \Exception */ protected function cleanUp() { $params = ['index' => $this->index]; if ($this->writer->getClient()->indices()->exists($params)) { $response = $this->writer->getClient()->indices()->delete($params); $this->assertArrayHasKey('acknowledged', $response); $this->assertTrue($response['acknowledged']); } }
public function run($action, array $parameters) { $actionMethod = $action . 'Action'; if (!method_exists($this, $actionMethod)) { throw new UserException(sprintf("Action '%s' does not exist.", $this['action'])); } try { $this->writer->getClient()->ping(); } catch (\Exception $e) { throw new Exception\UserException("Connection to elasticsearch failed"); } return $this->{$actionMethod}($parameters); }
/** * Cleanup test workspace * * @throws Elasticsearch\Common\Exceptions\Missing404Exception * @throws \Exception */ protected function cleanUp() { $params = ['index' => $this->index]; if ($this->writer->getClient()->indices()->exists($params)) { $response = $this->writer->getClient()->indices()->delete($params); $this->assertArrayHasKey('acknowledged', $response); $this->assertTrue($response['acknowledged']); } $configPath = './tests/data/run/config.yml'; if (file_exists($configPath)) { unlink($configPath); } }