public function testSetGetBody() { $body = 'my test body'; $this->serializer->expects($this->once())->method('serialize')->with($this->equalTo($body), $this->equalTo(array()))->will($this->returnValue($body)); $this->request->setBody($body); $this->assertSame($body, $this->request->getBody()); }
public function testDeleteSearch() { $this->createIndex(); $data = array('name' => 'test', 'value' => 'myTestVal' . rand(100, 10000)); $this->createDocument(self::TYPE, $data); $data = array('name' => 'test', 'value' => 'myTestVal' . rand(100, 10000)); $this->createDocument(self::TYPE, $data); $data = array('name' => 'mega', 'value' => 'myTestVal' . rand(100, 10000)); $this->createDocument(self::TYPE, $data); $this->refreshIndex(); $countRequest = new CountRequest(ES_INDEX, self::TYPE, $this->getSerializer()); /** @var CountResponse $response */ $response = $this->getClient()->send($countRequest); $this->assertSame(3, $response->getCount()); $deleteSearchRequest = new DeleteByQueryRequest(ES_INDEX, self::TYPE, $this->getSerializer()); $deleteSearchRequest->setBody(array('term' => array('name' => 'test'))); $response = $this->getClient()->send($deleteSearchRequest); $this->refreshIndex(); $this->assertContains('_indices', $response->getRawData()); $this->assertContains(ES_INDEX, $response->getRawData()); $response = $this->getClient()->send($countRequest); $this->assertSame(1, $response->getCount()); }