当前位置: 首页>>代码示例>>PHP>>正文


PHP Dn::fromString方法代码示例

本文整理汇总了PHP中Zend\Ldap\Dn::fromString方法的典型用法代码示例。如果您正苦于以下问题:PHP Dn::fromString方法的具体用法?PHP Dn::fromString怎么用?PHP Dn::fromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Ldap\Dn的用法示例。


在下文中一共展示了Dn::fromString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSimpleRecursiveIteration

 public function testSimpleRecursiveIteration()
 {
     $node = $this->getLDAP()->getBaseNode();
     $ri = new \RecursiveIteratorIterator($node, \RecursiveIteratorIterator::SELF_FIRST);
     $i = 0;
     foreach ($ri as $rdn => $n) {
         $dn = $n->getDn()->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER);
         $rdn = Ldap\Dn::implodeRdn($n->getRdnArray(), Ldap\Dn::ATTR_CASEFOLD_LOWER);
         if ($i == 0) {
             $this->assertEquals(Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER), $dn);
         } elseif ($i == 1) {
             $this->assertEquals('ou=Node', $rdn);
             $this->assertEquals($this->createDn('ou=Node,'), $dn);
         } else {
             if ($i < 4) {
                 $j = $i - 1;
                 $base = $this->createDn('ou=Node,');
             } else {
                 $j = $i - 3;
                 $base = Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER);
             }
             $this->assertEquals('ou=Test' . $j, $rdn);
             $this->assertEquals('ou=Test' . $j . ',' . $base, $dn);
         }
         $i++;
     }
     $this->assertEquals(9, $i);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:28,代码来源:ChildrenIterationTest.php

示例2: createDn

 protected function createDn($dn)
 {
     if (substr($dn, -1) !== ',') {
         $dn .= ',';
     }
     $dn = $dn . TESTS_ZEND_LDAP_WRITEABLE_SUBTREE;
     return Ldap\Dn::fromString($dn)->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:8,代码来源:AbstractOnlineTestCase.php

示例3: getSchemaDn

 /**
  * Returns the schema DN
  *
  * @return \Zend\Ldap\Dn
  */
 public function getSchemaDn()
 {
     $schemaDn = $this->getSchemaNamingContext();
     return \Zend\Ldap\Dn::fromString($schemaDn);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:10,代码来源:ActiveDirectory.php

示例4: testSaveWithDnObject

 public function testSaveWithDnObject()
 {
     $dn = Ldap\Dn::fromString($this->_createDn('ou=TestCreated,'));
     $data = array('ou' => 'TestCreated', 'objectclass' => 'organizationalUnit');
     try {
         $this->_getLDAP()->save($dn, $data);
         $this->assertTrue($this->_getLDAP()->exists($dn));
         $data['l'] = 'mylocation1';
         $this->_getLDAP()->save($dn, $data);
         $this->assertTrue($this->_getLDAP()->exists($dn));
         $entry = $this->_getLDAP()->getEntry($dn);
         $this->_getLDAP()->delete($dn);
         $this->assertEquals('mylocation1', $entry['l'][0]);
     } catch (Ldap\Exception $e) {
         if ($this->_getLDAP()->exists($dn)) {
             $this->_getLDAP()->delete($dn);
         }
         $this->fail($e->getMessage());
     }
 }
开发者ID:alab1001101,项目名称:zf2,代码行数:20,代码来源:CrudTest.php

示例5: testEmptyStringDn

 public function testEmptyStringDn()
 {
     $dnString = '';
     $dn = Ldap\Dn::fromString($dnString);
     $this->assertEquals($dnString, $dn->toString());
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:6,代码来源:CreationTest.php

示例6: testArrayAccessImplementation

 public function testArrayAccessImplementation()
 {
     $dnString = 'cn=Baker\\, Alice,cn=Users,dc=example,dc=com';
     $dn = Ldap\Dn::fromString($dnString);
     $this->assertEquals(array('cn' => 'Baker, Alice'), $dn[0]);
     $this->assertEquals(array('cn' => 'Users'), $dn[1]);
     $this->assertEquals(array('dc' => 'example'), $dn[2]);
     $this->assertEquals(array('dc' => 'com'), $dn[3]);
     $this->assertTrue(isset($dn[0]));
     $this->assertTrue(isset($dn[1]));
     $this->assertTrue(isset($dn[2]));
     $this->assertTrue(isset($dn[3]));
     $this->assertFalse(isset($dn[-1]));
     $this->assertFalse(isset($dn[4]));
     $dn = Ldap\Dn::fromString($dnString);
     unset($dn[0]);
     $this->assertEquals('cn=Users,dc=example,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     unset($dn[1]);
     $this->assertEquals('cn=Baker\\, Alice,dc=example,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     unset($dn[2]);
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     unset($dn[3]);
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     $dn[0] = array('uid' => 'abaker');
     $this->assertEquals('uid=abaker,cn=Users,dc=example,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     $dn[1] = array('ou' => 'Lab');
     $this->assertEquals('cn=Baker\\, Alice,ou=Lab,dc=example,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     $dn[2] = array('dc' => 'example', 'ou' => 'Test');
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example+ou=Test,dc=com', $dn->toString());
     $dn = Ldap\Dn::fromString($dnString);
     $dn[3] = array('dc' => 'de+fr');
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example,dc=de\\+fr', $dn->toString());
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:39,代码来源:ModificationTest.php

示例7: testIsChildOfWithDnObjects

 public function testIsChildOfWithDnObjects()
 {
     $dn1 = Ldap\Dn::fromString('cb=name1,cn=name2,dc=example,dc=org');
     $dn2 = Ldap\Dn::fromString('dc=example,dc=org');
     $this->assertTrue(Ldap\Dn::isChildOf($dn1, $dn2));
 }
开发者ID:rexmac,项目名称:zf2,代码行数:6,代码来源:MiscTest.php

示例8: getSchemaDn

 /**
  * Returns the schema DN
  *
  * @return \Zend\Ldap\Dn
  */
 public function getSchemaDn()
 {
     $schemaDn = $this->getSubschemaSubentry();
     return Ldap\Dn::fromString($schemaDn);
 }
开发者ID:GeeH,项目名称:zend-ldap,代码行数:10,代码来源:RootDse.php

示例9: testLoadFromLDAPWithDnObject

 public function testLoadFromLDAPWithDnObject()
 {
     $dn = Ldap\Dn::fromString($this->_createDn('ou=Test1,'));
     $node = Node::fromLDAP($dn, $this->_getLDAP());
     $this->assertInstanceOf('Zend\\Ldap\\Node', $node);
     $this->assertTrue($node->isAttached());
 }
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:7,代码来源:OnlineTest.php

示例10: testDnObjectCloning

 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 = Ldap\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 = Ldap\Node::fromArray(array('dn' => $dn3, 'ou' => 'Test'), false);
     $dn3->prepend(array('cn' => 'name'));
     $this->assertNotEquals($dn3->toString(), $node3->getDn()->toString());
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:16,代码来源:OfflineTest.php

示例11: testRecursiveCopyWithDnObjects

 public function testRecursiveCopyWithDnObjects()
 {
     $orgSubTreeDn = Ldap\Dn::fromString($this->_orgSubTreeDn);
     $newSubTreeDn = Ldap\Dn::fromString($this->_newSubTreeDn);
     $this->_getLDAP()->copy($orgSubTreeDn, $newSubTreeDn, true);
     $this->assertTrue($this->_getLDAP()->exists($orgSubTreeDn));
     $this->assertTrue($this->_getLDAP()->exists($newSubTreeDn));
     $this->assertEquals(3, $this->_getLDAP()->countChildren($orgSubTreeDn));
     $this->assertEquals(3, $this->_getLDAP()->countChildren('ou=Subtree1,' . $orgSubTreeDn->toString()));
     $this->assertEquals(3, $this->_getLDAP()->countChildren($newSubTreeDn));
     $this->assertEquals(3, $this->_getLDAP()->countChildren('ou=Subtree1,' . $newSubTreeDn->toString()));
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:12,代码来源:CopyRenameTest.php

示例12: testGetSingleEntryWithDnObject

 public function testGetSingleEntryWithDnObject()
 {
     $dn = Ldap\Dn::fromString($this->_createDn('ou=Test1,'));
     $entry = $this->_getLDAP()->getEntry($dn);
     $this->assertEquals($dn->toString(), $entry["dn"]);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:6,代码来源:SearchTest.php


注:本文中的Zend\Ldap\Dn::fromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。