public function testIndexCreateMappingTypeBased()
 {
     $this->createSampleData();
     $response = $this->indexRepository->getMapping(ES_INDEX, self::TYPE);
     $mapping = $response->getData()->getGatewayValue();
     $this->indexRepository->delete(ES_INDEX);
     $this->assertFalse($this->indexRepository->exists(ES_INDEX));
     $this->indexRepository->create(ES_INDEX);
     $this->indexRepository->createMapping($mapping, ES_INDEX, self::TYPE);
     $response = $this->indexRepository->getMapping(ES_INDEX, self::TYPE);
     $this->assertEquals($mapping, $response->getData()->getGatewayValue());
 }
 public function testExistsWithReturnFalse()
 {
     $index = 'myIndex';
     $type = null;
     $className = 'myClassName';
     $request = $this->getMockBuilder('Elastification\\Client\\Request\\RequestInterface')->disableOriginalConstructor()->getMock();
     $this->requestRepositoryFactory->expects($this->once())->method('create')->with($this->equalTo($className), $this->equalTo($index), $this->equalTo($type), $this->equalTo($this->serializer))->willReturn($request);
     $this->repositoryClassMap->expects($this->once())->method('getClassName')->with(IndexRepositoryInterface::INDEX_EXIST)->willReturn($className);
     $this->client->expects($this->once())->method('send')->willThrowException(new ClientException('test throw'));
     $result = $this->indexRepository->exists($index);
     $this->assertFalse($result);
 }