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 testCreateIndex() { $this->assertFalse($this->hasIndex()); $settings = array('settings' => array('index' => array('number_of_shards' => 3, 'number_of_replicas' => 2)), 'mappings' => array('test-type' => array('_source' => array('enabled' => false), 'properties' => array('test-field' => array('type' => 'string', 'index' => 'not_analyzed'))))); $createIndexRequest = new CreateIndexRequest(ES_INDEX, null, $this->getSerializer()); $createIndexRequest->setBody($settings); /** @var IndexResponse $response */ $response = $this->getClient()->send($createIndexRequest); $this->assertTrue($response->isOk()); $this->assertTrue($response->acknowledged()); $this->assertTrue($this->hasIndex()); }