Beispiel #1
0
 public function testMoveNode()
 {
     $dnOld = $this->_createDn('ou=Test1,');
     $dnNew = $this->_createDn('ou=Test,');
     $node = Node\Node::fromLDAP($dnOld, $this->_getLDAP());
     $node->setDn($dnNew);
     $node->update();
     $this->assertFalse($this->_getLDAP()->exists($dnOld));
     $this->assertTrue($this->_getLDAP()->exists($dnNew));
     $node = Node\Node::fromLDAP($dnNew, $this->_getLDAP());
     $node->move($dnOld);
     $node->update();
     $this->assertFalse($this->_getLDAP()->exists($dnNew));
     $this->assertTrue($this->_getLDAP()->exists($dnOld));
     $node = Node\Node::fromLDAP($dnOld, $this->_getLDAP());
     $node->rename($dnNew);
     $node->update();
     $this->assertFalse($this->_getLDAP()->exists($dnOld));
     $this->assertTrue($this->_getLDAP()->exists($dnNew));
 }
Beispiel #2
0
 public function testGetChanges()
 {
     $node = $this->_createTestNode();
     $node->host = array('d');
     $node->empty = 'not Empty';
     unset($node->boolean);
     $changes = $node->getChanges();
     $this->assertEquals(array('add' => array('empty' => array('not Empty')), 'delete' => array('boolean' => array()), 'replace' => array('host' => array('d'))), $changes);
     $node = Node\Node::create('uid=test,dc=example,dc=org', array('account'));
     $node->host = 'host';
     unset($node->cn);
     unset($node['sn']);
     $node['givenName'] = 'givenName';
     $node->appendToAttribute('objectClass', 'domain');
     $this->assertEquals(array('uid' => array('test'), 'objectclass' => array('account', 'domain'), 'host' => array('host'), 'givenname' => array('givenName')), $node->getChangedData());
     $this->assertEquals(array('add' => array('uid' => array('test'), 'objectclass' => array('account', 'domain'), 'host' => array('host'), 'givenname' => array('givenName')), 'delete' => array(), 'replace' => array()), $node->getChanges());
 }
Beispiel #3
0
 /**
  * @return Zend_LDAP_Node
  */
 protected function _createTestNode()
 {
     return \Zend\LDAP\Node\Node::fromArray($this->_createTestArrayData(), true);
 }
Beispiel #4
0
 public function testLoadFromLDAPWithDnObject()
 {
     $dn = LDAP\DN::fromString($this->_createDn('ou=Test1,'));
     $node = Node\Node::fromLDAP($dn, $this->_getLDAP());
     $this->assertType('Zend\\LDAP\\Node\\Node', $node);
     $this->assertTrue($node->isAttached());
 }