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 testIndexSettingsWithIndex() { $this->createIndex(); $this->createDocument(self::TYPE); $this->refreshIndex(); $indexSettingsRequest = new IndexSettingsRequest(ES_INDEX, null, $this->getSerializer()); /** @var ResponseInterface $response */ $response = $this->getClient()->send($indexSettingsRequest); $data = $response->getData()->getGatewayValue(); $this->assertArrayHasKey(ES_INDEX, $data); $this->assertEquals(1, $data[ES_INDEX]['settings']['index']['number_of_replicas']); $updateIndexSettingsRequest = new UpdateIndexSettingsRequest(ES_INDEX, null, $this->getSerializer()); $updateIndexSettingsRequest->setBody(array('index' => array('number_of_replicas' => 0))); /** @var IndexResponse $updateResponse */ $updateResponse = $this->getClient()->send($updateIndexSettingsRequest); $this->assertTrue($updateResponse->acknowledged()); /** @var ResponseInterface $response */ $response = $this->getClient()->send($indexSettingsRequest); $data = $response->getData()->getGatewayValue(); $this->assertArrayHasKey(ES_INDEX, $data); $this->assertEquals(0, $data[ES_INDEX]['settings']['index']['number_of_replicas']); }