public function testCreateResponse()
 {
     $rawData = 'raw data for testing';
     /** @noinspection PhpParamsInspection */
     $response = $this->request->createResponse($rawData, $this->serializer);
     $this->assertInstanceOf(self::RESPONSE_CLASS, $response);
 }
 public function testDeleteMappingWithIndexAndType()
 {
     $this->createIndex();
     $mapping = [self::TYPE => ['properties' => ['message' => ['type' => 'string']]]];
     $createMappingRequest = new CreateMappingRequest(ES_INDEX, self::TYPE, $this->getSerializer());
     $createMappingRequest->setBody($mapping);
     $this->getClient()->send($createMappingRequest);
     $deleteMappingRequest = new DeleteMappingRequest(ES_INDEX, self::TYPE, $this->getSerializer());
     /** @var IndexResponse $response */
     $response = $this->getClient()->send($deleteMappingRequest);
     $this->assertTrue($response->acknowledged());
     //check if exists
     $getMappingRequest = new GetMappingRequest(ES_INDEX, self::TYPE, $this->getSerializer());
     $response = $this->getClient()->send($getMappingRequest);
     $this->assertSame('{}', $response->getRawData());
 }
 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']);
 }