Пример #1
0
 /**
  * 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']);
     }
 }
Пример #2
0
 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);
 }
Пример #3
0
 /**
  * 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);
     }
 }