Exemplo n.º 1
0
 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());
 }
Exemplo n.º 2
0
 public function testCreateMapping()
 {
     $index = 'myIndex';
     $return = 'itsMe';
     $type = 'myType';
     $className = 'myClassName';
     $mapping = array('index' => 'mapping');
     $request = $this->getMockBuilder('Elastification\\Client\\Request\\RequestInterface')->disableOriginalConstructor()->getMock();
     $request->expects($this->once())->method('setBody')->with($this->equalTo($mapping));
     $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_CREATE_MAPPING)->willReturn($className);
     $this->client->expects($this->once())->method('send')->willReturn($return);
     $result = $this->indexRepository->createMapping($mapping, $index, $type);
     $this->assertSame($return, $result);
 }