$ldap =
new Adapter();
$this->
assertEquals('\20foo\3dbar\0d(baz)*\20',
$ldap->
escape(" foo=bar\r(baz)* ", '', LdapInterface::ESCAPE_DN
));
} /**
* @group functional
*/
public function testLdapQuery() { $ldap =
new Adapter($this->
getLdapConfig());
$ldap->
getConnection()->
bind('cn=admin,dc=symfony,dc=com', 'symfony'
);
$query =
$ldap->
createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))',
[]);
$result =
$query->
execute();
$this->
assertInstanceOf(Collection::
class,
$result);
$this->
assertCount(1,
$result);
$entry =
$result[0
];
$this->
assertInstanceOf(Entry::
class,
$entry);
$this->
assertEquals(['Fabien Potencier'
],
$entry->
getAttribute('cn'
));