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 testCreateMappingWithIndexAndType()
 {
     $this->createIndex();
     $mapping = [self::TYPE => ['properties' => ['message' => ['type' => 'string']]]];
     $createMappingRequest = new CreateMappingRequest(ES_INDEX, self::TYPE, $this->getSerializer());
     $createMappingRequest->setBody($mapping);
     /** @var IndexResponse $response */
     $response = $this->getClient()->send($createMappingRequest);
     $this->assertTrue($response->acknowledged());
     $this->refreshIndex();
     //check if exists
     $getMappingRequest = new GetMappingRequest(ES_INDEX, self::TYPE, $this->getSerializer());
     /** @var ResponseInterface $getMappingResponse */
     $getMappingResponse = $this->getClient()->send($getMappingRequest);
     $data = $getMappingResponse->getData()->getGatewayValue();
     $this->assertTrue(isset($data[ES_INDEX]));
     $mappings = $data[ES_INDEX]['mappings'];
     $this->assertTrue(isset($mappings[self::TYPE]['properties']));
     $this->assertTrue(isset($mappings[self::TYPE]['properties']['message']));
     $this->assertTrue(isset($mappings[self::TYPE]['properties']['message']['type']));
     $this->assertSame('string', $mappings[self::TYPE]['properties']['message']['type']);
 }