public function testSetGetBody() { $body = 'my test body'; $this->serializer->expects($this->once())->method('serialize')->with($this->equalTo($body), $this->equalTo(array()))->will($this->returnValue($body)); $this->request->setBody($body); $this->assertSame($body, $this->request->getBody()); }
public function testAliases() { $this->createIndex(); $this->refreshIndex(); $aliases = ['actions' => [['add' => ['index' => ES_INDEX, 'alias' => 'alias-' . ES_INDEX]]]]; $aliasesRequest = new UpdateAliasesRequest(null, null, $this->getSerializer()); $aliasesRequest->setBody($aliases); /** @var Response $response */ $response = $this->getClient()->send($aliasesRequest); $this->assertTrue($response->acknowledged()); $getAliasesRequest = new GetAliasesRequest(null, 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])); }