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 testIndexSettingsWithIndex()
 {
     $this->createIndex();
     $this->createDocument(self::TYPE);
     $this->refreshIndex();
     $indexSettingsRequest = new IndexSettingsRequest(ES_INDEX, null, $this->getSerializer());
     /** @var ResponseInterface $response */
     $response = $this->getClient()->send($indexSettingsRequest);
     $data = $response->getData()->getGatewayValue();
     $this->assertArrayHasKey(ES_INDEX, $data);
     $this->assertEquals(1, $data[ES_INDEX]['settings']['index']['number_of_replicas']);
     $updateIndexSettingsRequest = new UpdateIndexSettingsRequest(ES_INDEX, null, $this->getSerializer());
     $updateIndexSettingsRequest->setBody(array('index' => array('number_of_replicas' => 0)));
     /** @var IndexResponse $updateResponse */
     $updateResponse = $this->getClient()->send($updateIndexSettingsRequest);
     $this->assertTrue($updateResponse->acknowledged());
     /** @var ResponseInterface $response */
     $response = $this->getClient()->send($indexSettingsRequest);
     $data = $response->getData()->getGatewayValue();
     $this->assertArrayHasKey(ES_INDEX, $data);
     $this->assertEquals(0, $data[ES_INDEX]['settings']['index']['number_of_replicas']);
 }