public function testDnWithMultiValuedRdnRoundTrip() { $dn1 = 'cn=Surname\\, Firstname+uid=userid,cn=name2,dc=example,dc=org'; $dnArray = Ldap\Dn::explodeDn($dn1); $dn2 = Ldap\Dn::implodeDn($dnArray); $this->assertEquals($dn1, $dn2); }
/** * Copies a LDAP entry from one DN to another DN. * * @param string|Dn $from * @param string|Dn $to * @param boolean $recursively * @return Ldap Provides a fluid interface * @throws Exception\LdapException */ public function copy($from, $to, $recursively = false) { $entry = $this->getEntry($from, array(), true); if ($to instanceof Dn) { $toDnParts = $to->toArray(); } else { $toDnParts = Dn::explodeDn($to); } $this->add($to, $entry); if ($recursively === true && $this->countChildren($from) > 0) { $children = $this->getChildrenDns($from); foreach ($children as $c) { $cDnParts = Dn::explodeDn($c); $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts); $newChild = Dn::implodeDn($newChildParts); $this->copy($c, $newChild, true); } } return $this; }
public function testGetDnArray() { $data = $this->createTestArrayData(); $node = Ldap\Node::fromArray($data); $exA = Ldap\Dn::explodeDn($data['dn']); $this->assertEquals($exA, $node->getDnArray()); }
/** * @dataProvider rfc2253DnProvider */ public function testExplodeDnsProvidedByRFC2253($input, $expected) { $dnArray = Ldap\Dn::explodeDn($input); $this->assertEquals($expected, $dnArray); }