public function testUpdateDocument() { $this->createIndex(); $data = array('name' => 'test' . rand(100, 10000), 'value' => 'myTestVal' . rand(100, 10000)); $id = $this->createDocument(self::TYPE, $data); $this->refreshIndex(); $updateDocumentRequest = new UpdateDocumentRequest(ES_INDEX, self::TYPE, $this->getSerializer()); $updateDocumentRequest->setId($id); $data['name'] = 'testName'; $updateDocumentRequest->setBody($data); /** @var CreateUpdateDocumentResponse $updateDocumentResponse */ $updateDocumentResponse = $this->getClient()->send($updateDocumentRequest); $this->assertSame(ES_INDEX, $updateDocumentResponse->getIndex()); $this->assertSame(self::TYPE, $updateDocumentResponse->getType()); $this->assertSame(2, $updateDocumentResponse->getVersion()); $this->assertSame($id, $updateDocumentResponse->getId()); $this->assertTrue($updateDocumentResponse->isOk()); }
public function testConstructorWithJmsSerializer() { $this->serializer = $this->getMockBuilder('Elastification\\Client\\Serializer\\JmsSerializer')->disableOriginalConstructor()->getMock(); $request = new UpdateDocumentRequest(self::INDEX, self::TYPE, $this->serializer); $params = $request->getSerializerParams(); $this->assertSame($params['index'], self::INDEX); $this->assertSame($params['type'], self::TYPE); }