/** * Gets the solr client instance * @return SolrClient the solr client */ public function getClient() { if ($this->_writeConnection === null) { if ($this->_readConnection === null) { return null; } else { return $this->_readConnection->getClient(); } } else { return $this->_writeConnection->getClient(); } }
/** * Tests the client options * @expectedException SolrIllegalArgumentException */ public function testClientOptions() { $connection = new ASolrConnection(); $connection->clientOptions->hostname = SOLR_HOSTNAME; $connection->clientOptions->port = SOLR_PORT; $connection->clientOptions->path = SOLR_PATH; $client = $connection->getClient(); $this->assertTrue($client instanceof SolrClient); $connection->clientOptions = array(); $connection->setClient(null); $connection->getClient(); // should throw an exception }