Example #1
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 = Zend_Ldap_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());
 }
 public function testMoveDeletedNewNode()
 {
     $dnOld = $this->_createDn('ou=Test,');
     $dnNew = $this->_createDn('ou=TestNew,');
     $node1 = Zend_Ldap_Node::create($dnOld, array('organizationalUnit'));
     $node1->setDn($dnNew);
     $node1->delete();
     $node1->update($this->_getLdap());
     $this->assertFalse($this->_getLdap()->exists($dnOld));
     $this->assertFalse($this->_getLdap()->exists($dnNew));
 }