Elastica\Client::setConnections PHP Method

setConnections() public method

public setConnections ( array $connections )
$connections array
    public function setConnections(array $connections)
    {
        $this->_connectionPool->setConnections($connections);
        return $this;
    }

Usage Example

Example #1
0
 public function testWithNoValidConnection()
 {
     $connections = array(new \Elastica\Connection(array('host' => '255.255.255.0', 'timeout' => 2)), new \Elastica\Connection(array('host' => '45.45.45.45', 'port' => '80', 'timeout' => 2)), new \Elastica\Connection(array('host' => '10.123.213.123', 'timeout' => 2)));
     $count = 0;
     $client = new Client(array(), function () use(&$count) {
         ++$count;
     });
     $client->setConnections($connections);
     try {
         $client->request('/_aliases');
         $this->fail('Should throw exception as no connection valid');
     } catch (\Elastica\Exception\ConnectionException $e) {
         $this->assertEquals(count($connections), $count);
     }
 }
All Usage Examples Of Elastica\Client::setConnections