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 testCreate() { $index = 'myIndex'; $return = 'itsMe'; $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_CREATE)->willReturn($className); $this->client->expects($this->once())->method('send')->willReturn($return); $result = $this->indexRepository->create($index); $this->assertSame($return, $result); }