Commit c2865cea authored by Bas de Nooijer's avatar Bas de Nooijer

Merge pull request #111 from moshevds/setAdapter-with-options

Set the correct options on the adapter when using setAdapter.
parents 3eaf8274 a214d845
......@@ -249,7 +249,7 @@ class Solarium_Client extends Solarium_Configurable
return $this->_setOption('adapter', $adapter);
} else {
// forward options
$adapter->setOptions($this->_options);
$adapter->setOptions($this->getOption('adapteroptions'));
// overwrite existing adapter
$this->_adapter = $adapter;
return $this;
......
......@@ -159,6 +159,23 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$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()
{
$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