Ejemplo n.º 1
0
 public function testAliasesCat()
 {
     $alias = 'alias-' . ES_INDEX;
     $this->createIndex();
     $this->refreshIndex();
     $aliases = ['actions' => [['add' => ['index' => ES_INDEX, 'alias' => $alias]]]];
     $aliasesRequest = new AliasesRequest(null, null, $this->getSerializer());
     $aliasesRequest->setBody($aliases);
     $this->getClient()->send($aliasesRequest);
     $aliasesCatRequest = new AliasesCatRequest(null, null, $this->getSerializer());
     /** @var CountResponse $response */
     $response = $this->getClient()->send($aliasesCatRequest);
     $data = $response->getData();
     $this->assertCount(1, $data);
     $index = $data->getGatewayValue()[0];
     $this->assertCount(5, $index);
     $this->assertArrayHasKey('alias', $index);
     $this->assertArrayHasKey('index', $index);
     $this->assertArrayHasKey('filter', $index);
     $this->assertArrayHasKey('routing.index', $index);
     $this->assertArrayHasKey('routing.search', $index);
     $this->assertSame($alias, $index['alias']);
     $this->assertSame(ES_INDEX, $index['index']);
     $this->assertSame('-', $index['filter']);
     $this->assertSame('-', $index['routing.index']);
     $this->assertSame('-', $index['routing.search']);
 }
Ejemplo n.º 2
0
 public function testGetAliasesWitIndex()
 {
     $this->createIndex();
     $aliases = ['actions' => [['add' => ['index' => ES_INDEX, 'alias' => 'alias-' . ES_INDEX]]]];
     $aliasesRequest = new AliasesRequest(null, null, $this->getSerializer());
     $aliasesRequest->setBody($aliases);
     /** @var IndexResponse $response */
     $this->getClient()->send($aliasesRequest);
     $getAliasesRequest = new GetAliasesRequest(ES_INDEX, null, $this->getSerializer());
     /** @var Response $response */
     $response = $this->getClient()->send($getAliasesRequest);
     $data = $response->getData()->getGatewayValue();
     $this->assertArrayHasKey(ES_INDEX, $data);
     $this->assertTrue(isset($data[ES_INDEX]['aliases']['alias-' . ES_INDEX]));
 }
Ejemplo n.º 3
0
 public function testCreateResponse()
 {
     $rawData = 'raw data for testing';
     $response = $this->request->createResponse($rawData, $this->serializer);
     $this->assertInstanceOf(self::RESPONSE_CLASS, $response);
 }