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 testCreateDeleteTemplate()
 {
     $templateName = 'test-template';
     $template = ['template' => "te*", 'settings' => ["number_of_shards" => 1], 'mappings' => ['type1' => ['_source' => ["enabled" => false]]]];
     $createTemplateRequest = new CreateTemplateRequest($templateName, $this->getSerializer());
     $createTemplateRequest->setBody($template);
     /** @var IndexResponse $createResponse */
     $createResponse = $this->getClient()->send($createTemplateRequest);
     $this->assertTrue($createResponse->acknowledged());
     $getTemplateRequest = new GetTemplateRequest($templateName, $this->getSerializer());
     /** @var Response $getResponse */
     $getResponse = $this->getClient()->send($getTemplateRequest);
     $templates = $getResponse->getData()->getGatewayValue();
     $this->assertArrayHasKey($templateName, $templates);
     $this->assertEquals($template['template'], $templates[$templateName]['template']);
     $this->assertEquals($template['mappings'], $templates[$templateName]['mappings']);
     $deleteTemplateRequest = new DeleteTemplateRequest($templateName, $this->getSerializer());
     /** @var IndexResponse $deleteResponse */
     $deleteResponse = $this->getClient()->send($deleteTemplateRequest);
     $this->assertTrue($deleteResponse->acknowledged());
     $getTemplateRequest = new GetTemplateRequest($templateName, $this->getSerializer());
     try {
         /** @var Response $getResponse */
         $this->getClient()->send($getTemplateRequest);
     } catch (ClientException $exception) {
         $this->assertSame(404, $exception->getCode());
         return;
     }
     $this->fail();
 }