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

Merge branch 'develop' into feature/nextgen

Conflicts:
	library/Solarium/Client.php
	tests/Solarium/ClientTest.php
parents 2053bb76 c2865cea
...@@ -224,7 +224,7 @@ class Client extends Configurable ...@@ -224,7 +224,7 @@ class Client extends Configurable
foreach ($this->options as $name => $value) { foreach ($this->options as $name => $value) {
switch ($name) { switch ($name) {
case 'endpoint': case 'endpoint':
$this->addEndpoints($value); $this->setEndpoints($value);
break; break;
case 'querytype': case 'querytype':
$this->registerQueryTypes($value); $this->registerQueryTypes($value);
...@@ -452,7 +452,7 @@ class Client extends Configurable ...@@ -452,7 +452,7 @@ class Client extends Configurable
return $this->setOption('adapter', $adapter); return $this->setOption('adapter', $adapter);
} elseif ($adapter instanceof AdapterInterface) { } elseif ($adapter instanceof AdapterInterface) {
// 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;
......
...@@ -381,6 +381,23 @@ class ClientTest extends \PHPUnit_Framework_TestCase ...@@ -381,6 +381,23 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this->client->getAdapter(); $this->client->getAdapter();
} }
public function testSetAdapterWithOptions()
{
$adapterOptions = array(
'host' => 'myhost',
'port' => 8080,
'customOption' => 'foobar'
);
$observer = $this->getMock('Solarium\Core\Client\Adapter\Http', 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