示例#1
0
 public function testDnObjectCloning()
 {
     $node1 = $this->_createTestNode();
     $dn1 = LDAP\DN::fromString('cn=name2,dc=example,dc=org');
     $node1->setDn($dn1);
     $dn1->prepend(array('cn' => 'name'));
     $this->assertNotEquals($dn1->toString(), $node1->getDn()->toString());
     $dn2 = LDAP\DN::fromString('cn=name2,dc=example,dc=org');
     $node2 = Node\Node::create($dn2);
     $dn2->prepend(array('cn' => 'name'));
     $this->assertNotEquals($dn2->toString(), $node2->getDn()->toString());
     $dn3 = LDAP\DN::fromString('cn=name2,dc=example,dc=org');
     $node3 = Node\Node::fromArray(array('dn' => $dn3, 'ou' => 'Test'), false);
     $dn3->prepend(array('cn' => 'name'));
     $this->assertNotEquals($dn3->toString(), $node3->getDn()->toString());
 }
示例#2
0
 /**
  * @return Zend_LDAP_Node
  */
 protected function _createTestNode()
 {
     return \Zend\LDAP\Node\Node::fromArray($this->_createTestArrayData(), true);
 }
示例#3
0
 public function testExistsDn()
 {
     $data = array('dn' => $this->_createDn('ou=name,'), 'ou' => array('name'), 'l' => array('a', 'b', 'c'), 'objectClass' => array('organizationalUnit', 'top'));
     $node1 = Node\Node::fromArray($data);
     $node1->attachLDAP($this->_getLDAP());
     $this->assertFalse($node1->exists());
     $dn = $this->_createDn('ou=Test1,');
     $node2 = Node\Node::fromLDAP($dn, $this->_getLDAP());
     $this->assertTrue($node2->exists());
 }