Commit a214d845 authored by Môshe van der Sterre's avatar Môshe van der Sterre

Set the correct options on the adapter when using setAdapter.

This modifies setAdapter to use the 'adapteroptions' option
introduced by commit bb14ee6b.
parent 0ed951d3
...@@ -239,7 +239,7 @@ class Solarium_Client extends Solarium_Configurable ...@@ -239,7 +239,7 @@ class Solarium_Client extends Solarium_Configurable
return $this->_setOption('adapter', $adapter); return $this->_setOption('adapter', $adapter);
} else { } else {
// forward options // forward options
$adapter->setOptions($this->_options); $adapter->setOptions($this->getOption('adapteroptions'));
// overwrite existing adapter // overwrite existing adapter
$this->_adapter = $adapter; $this->_adapter = $adapter;
return $this; return $this;
......
...@@ -159,6 +159,23 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase ...@@ -159,6 +159,23 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$this->assertThat($this->_client->getAdapter(), $this->isInstanceOf($adapterClass)); $this->assertThat($this->_client->getAdapter(), $this->isInstanceOf($adapterClass));
} }
public function testSetAdapterWithOptions()
{
$adapterOptions = array(
'host' => 'myhost',
'port' => 8080,
'customOption' => 'foobar'
);
$observer = $this->getMock('Solarium_Client_Adapter', array('setOptions', 'execute'));
$observer->expects($this->once())
->method('setOptions')
->with($this->equalTo($adapterOptions));
$this->_client->setOptions(array('adapteroptions' => $adapterOptions));
$this->_client->setAdapter($observer);
}
public function testRegisterQueryTypeAndGetQueryTypes() public function testRegisterQueryTypeAndGetQueryTypes()
{ {
$queryTypes = $this->_client->getQueryTypes(); $queryTypes = $this->_client->getQueryTypes();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment