Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
8ad5ce2d
Commit
8ad5ce2d
authored
Feb 23, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed client adapter lazy loading
- update client test for lazy loading
parent
9875c7eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
library/Solarium/Client.php
library/Solarium/Client.php
+11
-4
tests/Solarium/ClientTest.php
tests/Solarium/ClientTest.php
+1
-1
No files found.
library/Solarium/Client.php
View file @
8ad5ce2d
...
...
@@ -209,22 +209,29 @@ class Solarium_Client extends Solarium_Configurable
* Set the adapter
*
* The adapter has to be a class that extends Solarium_Client_Adapter.
*
* If a string is passed it is assumed to be the classname and it will be
* instantiated on first use. This requires the availability of the class
* through autoloading or a manual require before calling this method.
*
* Any existing adapter instance will be removed by this method, this way an
* instance of the new adapter type will be created upon the next usage of
* the adapter (lazy-loading)
*
* If an adapter instance is passed it will replace the current adapter
* immediately, bypassing the lazy loading.
*
* @param string|Solarium_Client_Adapter $adapter
* @return Solarium_Client Provides fluent interface
*/
public
function
setAdapter
(
$adapter
)
{
if
(
is_string
(
$adapter
))
{
$this
->
_adapter
=
null
;
return
$this
->
_setOption
(
'adapter'
,
$adapter
);
}
else
{
$this
->
_adapter
=
$adapter
;
return
$this
;
}
}
/**
...
...
tests/Solarium/ClientTest.php
View file @
8ad5ce2d
...
...
@@ -101,7 +101,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$observer
->
expects
(
$this
->
once
())
->
method
(
'setOptions'
)
->
with
(
$this
->
equalTo
(
$options
));
$client
->
setAdapter
(
$observer
);
$client
->
setAdapter
(
$observer
)
->
getAdapter
()
;
}
public
function
testOptionForwardingToAdapterAfterChange
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment