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 testCountWithBody() { $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()); $countRequest->setBody(array('query' => array('term' => array('name' => 'test')))); /** @var CountResponse $response */ $response = $this->getClient()->send($countRequest); $this->assertSame(2, $response->getCount()); $shards = $response->getShards(); $this->assertTrue(isset($shards['total'])); $this->assertTrue(isset($shards['successful'])); $this->assertTrue(isset($shards['failed'])); }