Ldap/Query: Remove __toString()
This is needed because of exception handling. Exceptions can now bubble up for default handling. Method render() was renamed to create() because the method create a query. Adjust the test for method create(). refs #5536
This commit is contained in:
parent
baf768040f
commit
ee6145a173
|
@ -307,7 +307,7 @@ class Connection
|
|||
$results = @ldap_search(
|
||||
$this->ds,
|
||||
$base,
|
||||
(string) $query,
|
||||
$query->create(),
|
||||
$fields,
|
||||
0, // Attributes and values
|
||||
0 // No limit - at least where possible
|
||||
|
@ -619,7 +619,7 @@ class Connection
|
|||
$result = @ldap_read(
|
||||
$ds,
|
||||
'',
|
||||
(string) $query,
|
||||
$query->create(),
|
||||
$query->listFields()
|
||||
);
|
||||
|
||||
|
|
|
@ -300,17 +300,7 @@ class Query
|
|||
*
|
||||
* @string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the LDAP filter that will be applied
|
||||
*
|
||||
* @string
|
||||
*/
|
||||
protected function render()
|
||||
public function create()
|
||||
{
|
||||
$parts = array();
|
||||
if (! isset($this->filters['objectClass']) || $this->filters['objectClass'] === null) {
|
||||
|
|
|
@ -109,10 +109,10 @@ class QueryTest extends BaseTestCase
|
|||
$this->assertEquals('testIntColumn', $cols[0][0]);
|
||||
}
|
||||
|
||||
public function test__toString()
|
||||
public function testCreateQuery()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
$res = '(&(objectClass=dummyClass)(testIntColumn=1)(testStringColumn=test)(testWildcard=abc*))';
|
||||
$this->assertEquals($res, (string) $select);
|
||||
$this->assertEquals($res, $select->create());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue