Exemplo n.º 1
0
 public function testGetSetWarmerName()
 {
     $warmerName = 'test-warmer-name';
     $this->assertNull($this->request->getWarmerName());
     $this->request->setWarmerName($warmerName);
     $this->assertSame($warmerName, $this->request->getWarmerName());
 }
 public function testCreateDeleteWarmer()
 {
     $this->createIndex();
     $this->refreshIndex();
     $warmerName = 'test_warmer';
     $warmer = ['query' => ['match_all' => []]];
     $createWarmerRequest = new CreateWarmerRequest(ES_INDEX, null, $this->getSerializer());
     $createWarmerRequest->setWarmerName($warmerName);
     $createWarmerRequest->setBody($warmer);
     /** @var IndexResponse $createResponse */
     $createResponse = $this->getClient()->send($createWarmerRequest);
     $this->assertTrue($createResponse->acknowledged());
     $this->refreshIndex();
     $getWarmerRequest = new GetWarmerRequest(ES_INDEX, null, $this->getSerializer());
     $getWarmerRequest->setWarmerName($warmerName);
     $getResponse = $this->getClient()->send($getWarmerRequest);
     $data = $getResponse->getData()->getGatewayValue();
     $this->assertArrayHasKey($warmerName, $data[ES_INDEX]['warmers']);
     $deleteRequest = new DeleteWarmerRequest(ES_INDEX, null, $this->getSerializer());
     $deleteRequest->setWarmerName($warmerName);
     /** @var IndexResponse $deleteResponse */
     $deleteResponse = $this->getClient()->send($deleteRequest);
     $this->assertTrue($deleteResponse->acknowledged());
     $getWarmerRequest = new GetWarmerRequest(ES_INDEX, null, $this->getSerializer());
     $getWarmerRequest->setWarmerName($warmerName);
     $getResponse = $this->getClient()->send($getWarmerRequest);
     $this->assertEmpty($getResponse->getData()->getGatewayValue());
 }