diff --git a/library/Zend/Authentication/Adapter/Ldap.php b/library/Zend/Authentication/Adapter/Ldap.php index cab31d47d4a..655b4c6312b 100644 --- a/library/Zend/Authentication/Adapter/Ldap.php +++ b/library/Zend/Authentication/Adapter/Ldap.php @@ -204,7 +204,7 @@ public function setCredential($credential) public function getLdap() { if ($this->_ldap === null) { - $this->_ldap = new \Zend\LDAP\LDAP(); + $this->_ldap = new \Zend\Ldap\Ldap(); } return $this->_ldap; @@ -216,7 +216,7 @@ public function getLdap() * @param Zend_Ldap $ldap An existing Ldap object * @return Zend\Authentication\Adapter\Ldap Provides a fluent interface */ - public function setLdap(\Zend\LDAP\LDAP $ldap) + public function setLdap(\Zend\Ldap\Ldap $ldap) { $this->_ldap = $ldap; @@ -321,7 +321,7 @@ public function authenticate() $ldap->bind(); $requireRebind = true; } - $dn = $ldap->getCanonicalAccountName($canonicalName, \Zend\LDAP\LDAP::ACCTNAME_FORM_DN); + $dn = $ldap->getCanonicalAccountName($canonicalName, \Zend\Ldap\Ldap::ACCTNAME_FORM_DN); $groupResult = $this->_checkGroupMembership($ldap, $canonicalName, $dn, $adapterOptions); if ($groupResult === true) { @@ -339,7 +339,7 @@ public function authenticate() $messages[1] = $groupResult; $failedAuthorities[$dname] = $groupResult; } - } catch (\Zend\LDAP\Exception $zle) { + } catch (\Zend\Ldap\Exception $zle) { /* LDAP based authentication is notoriously difficult to diagnose. Therefore * we bend over backwards to capture and record every possible bit of @@ -348,18 +348,18 @@ public function authenticate() $err = $zle->getCode(); - if ($err == \Zend\LDAP\Exception::LDAP_X_DOMAIN_MISMATCH) { + if ($err == \Zend\Ldap\Exception::LDAP_X_DOMAIN_MISMATCH) { /* This error indicates that the domain supplied in the * username did not match the domains in the server options * and therefore we should just skip to the next set of * server options. */ continue; - } else if ($err == \Zend\LDAP\Exception::LDAP_NO_SUCH_OBJECT) { + } else if ($err == \Zend\Ldap\Exception::LDAP_NO_SUCH_OBJECT) { $code = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND; $messages[0] = "Account not found: $username"; $failedAuthorities[$dname] = $zle->getMessage(); - } else if ($err == \Zend\LDAP\Exception::LDAP_INVALID_CREDENTIALS) { + } else if ($err == \Zend\Ldap\Exception::LDAP_INVALID_CREDENTIALS) { $code = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; $messages[0] = 'Invalid credentials'; $failedAuthorities[$dname] = $zle->getMessage(); @@ -386,12 +386,12 @@ public function authenticate() * @param array $options * @return array of auth-adapter specific options */ - protected function _prepareOptions(\Zend\LDAP\LDAP $ldap, array $options) + protected function _prepareOptions(\Zend\Ldap\Ldap $ldap, array $options) { $adapterOptions = array( 'group' => null, 'groupDn' => $ldap->getBaseDn(), - 'groupScope' => \Zend\LDAP\LDAP::SEARCH_SCOPE_SUB, + 'groupScope' => \Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, 'groupAttr' => 'cn', 'groupFilter' => 'objectClass=groupOfUniqueNames', 'memberAttr' => 'uniqueMember', @@ -404,8 +404,8 @@ protected function _prepareOptions(\Zend\LDAP\LDAP $ldap, array $options) switch ($key) { case 'groupScope': $value = (int)$value; - if (in_array($value, array(\Zend\LDAP\LDAP::SEARCH_SCOPE_BASE, - \Zend\LDAP\LDAP::SEARCH_SCOPE_ONE, \Zend\LDAP\LDAP::SEARCH_SCOPE_SUB), true)) { + if (in_array($value, array(\Zend\Ldap\Ldap::SEARCH_SCOPE_BASE, + \Zend\Ldap\Ldap::SEARCH_SCOPE_ONE, \Zend\Ldap\Ldap::SEARCH_SCOPE_SUB), true)) { $adapterOptions[$key] = $value; } break; @@ -432,7 +432,7 @@ protected function _prepareOptions(\Zend\LDAP\LDAP $ldap, array $options) * @param array $adapterOptions * @return string|true */ - protected function _checkGroupMembership(\Zend\LDAP\LDAP $ldap, $canonicalName, $dn, array $adapterOptions) + protected function _checkGroupMembership(\Zend\Ldap\Ldap $ldap, $canonicalName, $dn, array $adapterOptions) { if ($adapterOptions['group'] === null) { return true; @@ -444,9 +444,9 @@ protected function _checkGroupMembership(\Zend\LDAP\LDAP $ldap, $canonicalName, $user = $dn; } - $groupName = \Zend\LDAP\Filter\Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']); - $membership = \Zend\LDAP\Filter\Filter::equals($adapterOptions['memberAttr'], $user); - $group = \Zend\LDAP\Filter\Filter::andFilter($groupName, $membership); + $groupName = \Zend\Ldap\Filter\Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']); + $membership = \Zend\Ldap\Filter\Filter::equals($adapterOptions['memberAttr'], $user); + $group = \Zend\Ldap\Filter\Filter::andFilter($groupName, $membership); $groupFilter = $adapterOptions['groupFilter']; if (!empty($groupFilter)) { $group = $group->addAnd($groupFilter); diff --git a/library/Zend/LDAP/Attribute.php b/library/Zend/Ldap/Attribute.php similarity index 98% rename from library/Zend/LDAP/Attribute.php rename to library/Zend/Ldap/Attribute.php index d9da713682f..4e807a91151 100644 --- a/library/Zend/LDAP/Attribute.php +++ b/library/Zend/Ldap/Attribute.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,13 +22,13 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Attribute is a collection of LDAP attribute related functions. + * Zend_Ldap_Attribute is a collection of LDAP attribute related functions. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/LDAP/Collection.php b/library/Zend/Ldap/Collection.php similarity index 92% rename from library/Zend/LDAP/Collection.php rename to library/Zend/Ldap/Collection.php index 1db83b6a924..b640a9a526a 100644 --- a/library/Zend/LDAP/Collection.php +++ b/library/Zend/Ldap/Collection.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,15 +22,15 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Collection wraps a list of LDAP entries. + * Zend_Ldap_Collection wraps a list of LDAP entries. * * @uses Countable * @uses Iterator * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -39,7 +39,7 @@ class Collection implements \Iterator, \Countable /** * Iterator * - * @var \Zend\LDAP\Collection\DefaultIterator + * @var \Zend\Ldap\Collection\DefaultIterator */ protected $_iterator = null; @@ -60,7 +60,7 @@ class Collection implements \Iterator, \Countable /** * Constructor. * - * @param \Zend\LDAP\Collection\DefaultIterator $iterator + * @param \Zend\Ldap\Collection\DefaultIterator $iterator */ public function __construct(Collection\DefaultIterator $iterator) { @@ -114,7 +114,7 @@ public function getFirst() /** * Returns the underlying iterator * - * @return \Zend\LDAP\Collection\DefaultIterator + * @return \Zend\Ldap\Collection\DefaultIterator */ public function getInnerIterator() { @@ -137,7 +137,7 @@ public function count() * Implements Iterator * * @return array|null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function current() { @@ -208,7 +208,7 @@ public function key() * Move forward to next result item * Implements Iterator * - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function next() { @@ -220,7 +220,7 @@ public function next() * Rewind the Iterator to the first result item * Implements Iterator * - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function rewind() { diff --git a/library/Zend/LDAP/Collection/DefaultIterator.php b/library/Zend/Ldap/Collection/DefaultIterator.php similarity index 86% rename from library/Zend/LDAP/Collection/DefaultIterator.php rename to library/Zend/Ldap/Collection/DefaultIterator.php index 7844fa5994e..41597dce9dc 100644 --- a/library/Zend/LDAP/Collection/DefaultIterator.php +++ b/library/Zend/Ldap/Collection/DefaultIterator.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,18 +22,18 @@ /** * @namespace */ -namespace Zend\LDAP\Collection; -use Zend\LDAP; +namespace Zend\Ldap\Collection; +use Zend\Ldap; /** - * Zend_LDAP_Collection_Iterator_Default is the default collection iterator implementation + * Zend_Ldap_Collection_Iterator_Default is the default collection iterator implementation * using ext/ldap * * @uses Countable * @uses Iterator - * @uses \Zend\LDAP\Exception + * @uses \Zend\Ldap\Exception * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -46,7 +46,7 @@ class DefaultIterator implements \Iterator, \Countable /** * LDAP Connection * - * @var \Zend\LDAP\LDAP + * @var \Zend\Ldap\Ldap */ protected $_ldap = null; @@ -81,17 +81,17 @@ class DefaultIterator implements \Iterator, \Countable /** * Constructor. * - * @param \Zend\LDAP\LDAP $ldap + * @param \Zend\Ldap\Ldap $ldap * @param resource $resultId * @return void */ - public function __construct(LDAP\LDAP $ldap, $resultId) + public function __construct(Ldap\Ldap $ldap, $resultId) { $this->_ldap = $ldap; $this->_resultId = $resultId; $this->_itemCount = @ldap_count_entries($ldap->getResource(), $resultId); if ($this->_itemCount === false) { - throw new LDAP\Exception($this->_ldap, 'counting entries'); + throw new Ldap\Exception($this->_ldap, 'counting entries'); } } @@ -119,7 +119,7 @@ public function close() /** * Gets the current LDAP connection. * - * @return \Zend\LDAP\LDAP + * @return \Zend\Ldap\Ldap */ public function getLDAP() { @@ -130,14 +130,14 @@ public function getLDAP() * Sets the attribute name treatment. * * Can either be one of the following constants - * - Zend_LDAP_Collection_Iterator_Default::ATTRIBUTE_TO_LOWER - * - Zend_LDAP_Collection_Iterator_Default::ATTRIBUTE_TO_UPPER - * - Zend_LDAP_Collection_Iterator_Default::ATTRIBUTE_NATIVE + * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_LOWER + * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_UPPER + * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_NATIVE * or a valid callback accepting the attribute's name as it's only * argument and returning the new attribute's name. * * @param integer|callback $attributeNameTreatment - * @return \Zend\LDAP\Collection\DefaultIterator Provides a fluent interface + * @return \Zend\Ldap\Collection\DefaultIterator Provides a fluent interface */ public function setAttributeNameTreatment($attributeNameTreatment) { @@ -192,7 +192,7 @@ public function count() * Implements Iterator * * @return array|null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function current() { @@ -247,7 +247,7 @@ public function key() if (is_resource($this->_current)) { $currentDn = @ldap_get_dn($this->_ldap->getResource(), $this->_current); if ($currentDn === false) { - throw new LDAP\Exception($this->_ldap, 'getting dn'); + throw new Ldap\Exception($this->_ldap, 'getting dn'); } return $currentDn; } else { @@ -259,7 +259,7 @@ public function key() * Move forward to next result item * Implements Iterator * - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function next() { @@ -267,11 +267,11 @@ public function next() $this->_current = @ldap_next_entry($this->_ldap->getResource(), $this->_current); if ($this->_current === false) { $msg = $this->_ldap->getLastError($code); - if ($code === LDAP\Exception::LDAP_SIZELIMIT_EXCEEDED) { + if ($code === Ldap\Exception::LDAP_SIZELIMIT_EXCEEDED) { // we have reached the size limit enforced by the server return; - } else if ($code > LDAP\Exception::LDAP_SUCCESS) { - throw new LDAP\Exception($this->_ldap, 'getting next entry (' . $msg . ')'); + } else if ($code > Ldap\Exception::LDAP_SUCCESS) { + throw new Ldap\Exception($this->_ldap, 'getting next entry (' . $msg . ')'); } } } @@ -281,15 +281,15 @@ public function next() * Rewind the Iterator to the first result item * Implements Iterator * - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function rewind() { if (is_resource($this->_resultId)) { $this->_current = @ldap_first_entry($this->_ldap->getResource(), $this->_resultId); if ($this->_current === false && - $this->_ldap->getLastErrorCode() > LDAP\Exception::LDAP_SUCCESS) { - throw new LDAP\Exception($this->_ldap, 'getting first entry'); + $this->_ldap->getLastErrorCode() > Ldap\Exception::LDAP_SUCCESS) { + throw new Ldap\Exception($this->_ldap, 'getting first entry'); } } } diff --git a/library/Zend/LDAP/Converter.php b/library/Zend/Ldap/Converter.php similarity index 94% rename from library/Zend/LDAP/Converter.php rename to library/Zend/Ldap/Converter.php index 5d45235c5b5..0e8b258fd18 100644 --- a/library/Zend/LDAP/Converter.php +++ b/library/Zend/Ldap/Converter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,13 +22,13 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Converter is a collection of useful LDAP related conversion functions. + * Zend_Ldap_Converter is a collection of useful LDAP related conversion functions. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/LDAP/DN.php b/library/Zend/Ldap/Dn.php similarity index 93% rename from library/Zend/LDAP/DN.php rename to library/Zend/Ldap/Dn.php index c00d24045a7..bf818307083 100644 --- a/library/Zend/LDAP/DN.php +++ b/library/Zend/Ldap/Dn.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,21 +22,21 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Dn provides an API for DN manipulation + * Zend_Ldap_Dn provides an API for DN manipulation * * @uses ArrayAccess - * @uses \Zend\LDAP\Converter - * @uses \Zend\LDAP\DN - * @uses \Zend\LDAP\Exception + * @uses \Zend\Ldap\Converter + * @uses \Zend\Ldap\Dn + * @uses \Zend\Ldap\Exception * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class DN implements \ArrayAccess +class Dn implements \ArrayAccess { const ATTR_CASEFOLD_NONE = 'none'; const ATTR_CASEFOLD_UPPER = 'upper'; @@ -68,8 +68,8 @@ class DN implements \ArrayAccess * * @param string|array $dn * @param string|null $caseFold - * @return \Zend\LDAP\DN - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Dn + * @throws \Zend\Ldap\Exception */ public static function factory($dn, $caseFold = null) { @@ -87,8 +87,8 @@ public static function factory($dn, $caseFold = null) * * @param string $dn * @param string|null $caseFold - * @return \Zend\LDAP\DN - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Dn + * @throws \Zend\Ldap\Exception */ public static function fromString($dn, $caseFold = null) { @@ -106,8 +106,8 @@ public static function fromString($dn, $caseFold = null) * * @param array $dn * @param string|null $caseFold - * @return \Zend\LDAP\DN - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Dn + * @throws \Zend\Ldap\Exception */ public static function fromArray(array $dn, $caseFold = null) { @@ -131,7 +131,7 @@ protected function __construct(array $dn, $caseFold) * * @param string $caseFold * @return array - * @throws \Zend\LDAP\Exception if DN has no RDN (empty array) + * @throws \Zend\Ldap\Exception if DN has no RDN (empty array) */ public function getRdn($caseFold = null) { @@ -144,7 +144,7 @@ public function getRdn($caseFold = null) * * @param string $caseFold * @return string - * @throws \Zend\LDAP\Exception if DN has no RDN (empty array) + * @throws \Zend\Ldap\Exception if DN has no RDN (empty array) */ public function getRdnString($caseFold = null) { @@ -156,7 +156,7 @@ public function getRdnString($caseFold = null) * Get the parent DN $levelUp levels up the tree * * @param int $levelUp - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ public function getParentDn($levelUp = 1) { @@ -175,7 +175,7 @@ public function getParentDn($levelUp = 1) * @param int $length * @param string $caseFold * @return array - * @throws \Zend\LDAP\Exception if index is illegal + * @throws \Zend\Ldap\Exception if index is illegal */ public function get($index, $length = 1, $caseFold = null) { @@ -198,8 +198,8 @@ public function get($index, $length = 1, $caseFold = null) * * @param int $index * @param array $value - * @return \Zend\LDAP\DN Provides a fluent interface - * @throws \Zend\LDAP\Exception if index is illegal + * @return \Zend\Ldap\Dn Provides a fluent interface + * @throws \Zend\Ldap\Exception if index is illegal */ public function set($index, array $value) { @@ -214,8 +214,8 @@ public function set($index, array $value) * * @param int $index * @param int $length - * @return \Zend\LDAP\DN Provides a fluent interface - * @throws \Zend\LDAP\Exception if index is illegal + * @return \Zend\Ldap\Dn Provides a fluent interface + * @throws \Zend\Ldap\Exception if index is illegal */ public function remove($index, $length = 1) { @@ -232,7 +232,7 @@ public function remove($index, $length = 1) * Append a DN part * * @param array $value - * @return \Zend\LDAP\DN Provides a fluent interface + * @return \Zend\Ldap\Dn Provides a fluent interface */ public function append(array $value) { @@ -245,7 +245,7 @@ public function append(array $value) * Prepend a DN part * * @param array $value - * @return \Zend\LDAP\DN Provides a fluent interface + * @return \Zend\Ldap\Dn Provides a fluent interface */ public function prepend(array $value) { @@ -259,8 +259,8 @@ public function prepend(array $value) * * @param int $index * @param array $value - * @return \Zend\LDAP\DN Provides a fluent interface - * @throws \Zend\LDAP\Exception if index is illegal + * @return \Zend\Ldap\Dn Provides a fluent interface + * @throws \Zend\Ldap\Exception if index is illegal */ public function insert($index, array $value) { @@ -277,7 +277,7 @@ public function insert($index, array $value) * * @param mixed $index * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _assertIndex($index) { @@ -295,7 +295,7 @@ protected function _assertIndex($index) * * @param array $value * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected static function _assertRdn(array $value) { @@ -325,7 +325,7 @@ public function setCaseFold($caseFold) * * @param string $caseFold * @return string - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function toString($caseFold = null) { @@ -557,7 +557,7 @@ public static function unescapeValue($values = array()) * @param array $vals An optional array to receive DN values * @param string $caseFold * @return array - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public static function explodeDn($dn, array &$keys = null, array &$vals = null, $caseFold = self::ATTR_CASEFOLD_NONE) @@ -685,7 +685,7 @@ public static function checkDn($dn, array &$keys = null, array &$vals = null, * @param array $attribute * @param string $caseFold * @return string - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public static function implodeRdn(array $part, $caseFold = null) { @@ -717,7 +717,7 @@ public static function implodeRdn(array $part, $caseFold = null) * @param string $caseFold * @param string $separator * @return string - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public static function implodeDn(array $dnArray, $caseFold = null, $separator = ',') { @@ -731,8 +731,8 @@ public static function implodeDn(array $dnArray, $caseFold = null, $separator = /** * Checks if given $childDn is beneath $parentDn subtree. * - * @param string|\Zend\LDAP\DN $childDn - * @param string|\Zend\LDAP\DN $parentDn + * @param string|\Zend\Ldap\Dn $childDn + * @param string|\Zend\Ldap\Dn $parentDn * @return boolean */ public static function isChildOf($childDn, $parentDn) diff --git a/library/Zend/LDAP/Exception.php b/library/Zend/Ldap/Exception.php similarity index 97% rename from library/Zend/LDAP/Exception.php rename to library/Zend/Ldap/Exception.php index 314c14bbec5..e5d70028c25 100644 --- a/library/Zend/LDAP/Exception.php +++ b/library/Zend/Ldap/Exception.php @@ -14,7 +14,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -23,12 +23,12 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** * @uses \Zend\Exception * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @uses \Zend\Exception * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -118,7 +118,7 @@ class Exception extends \Zend\Exception const LDAP_X_EXTENSION_NOT_LOADED = 0x7002; /** - * @param \Zend\LDAP\LDAP $ldap A \Zend\LDAP\LDAP object + * @param \Zend\Ldap\Ldap $ldap A \Zend\Ldap\Ldap object * @param string $str An informtive exception message * @param int $code An LDAP error code */ @@ -152,7 +152,7 @@ public function __construct(LDAP $ldap = null, $str = null, $code = 0) /** * @deprecated not necessary any more - will be removed - * @param \Zend\LDAP\LDAP $ldap A \Zend\LDAP\LDAP object + * @param \Zend\Ldap\Ldap $ldap A \Zend\Ldap\Ldap object * @return int The current error code for the resource */ public static function getLDAPCode(LDAP $ldap = null) diff --git a/library/Zend/LDAP/Filter.php b/library/Zend/Ldap/Filter.php similarity index 85% rename from library/Zend/LDAP/Filter.php rename to library/Zend/Ldap/Filter.php index 8d354bf6f21..71af18f240f 100644 --- a/library/Zend/LDAP/Filter.php +++ b/library/Zend/Ldap/Filter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,17 +23,17 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Filter. + * Zend_Ldap_Filter. * - * @uses \Zend\LDAP\Filter\AndFilter - * @uses \Zend\LDAP\Filter\MaskFilter - * @uses \Zend\LDAP\Filter\OrFilter - * @uses \Zend\LDAP\Filter\StringFilter + * @uses \Zend\Ldap\Filter\AndFilter + * @uses \Zend\Ldap\Filter\MaskFilter + * @uses \Zend\Ldap\Filter\OrFilter + * @uses \Zend\Ldap\Filter\StringFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -53,7 +53,7 @@ class Filter extends Filter\StringFilter * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function equals($attr, $value) { @@ -66,7 +66,7 @@ public static function equals($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function begins($attr, $value) { @@ -79,7 +79,7 @@ public static function begins($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function ends($attr, $value) { @@ -92,7 +92,7 @@ public static function ends($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function contains($attr, $value) { @@ -105,7 +105,7 @@ public static function contains($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function greater($attr, $value) { @@ -118,7 +118,7 @@ public static function greater($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function greaterOrEqual($attr, $value) { @@ -131,7 +131,7 @@ public static function greaterOrEqual($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function less($attr, $value) { @@ -144,7 +144,7 @@ public static function less($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function lessOrEqual($attr, $value) { @@ -157,7 +157,7 @@ public static function lessOrEqual($attr, $value) * * @param string $attr * @param string $value - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function approx($attr, $value) { @@ -169,7 +169,7 @@ public static function approx($attr, $value) * (attr=*) * * @param string $attr - * @return \Zend\LDAP\Filter + * @return \Zend\Ldap\Filter */ public static function any($attr) { @@ -180,7 +180,7 @@ public static function any($attr) * Creates a simple custom string filter. * * @param string $filter - * @return \Zend\LDAP\Filter\StringFilter + * @return \Zend\Ldap\Filter\StringFilter */ public static function string($filter) { @@ -192,7 +192,7 @@ public static function string($filter) * * @param string $mask * @param string $value - * @return \Zend\LDAP\Filter\MaskFilter + * @return \Zend\Ldap\Filter\MaskFilter */ public static function mask($mask, $value) { @@ -202,8 +202,8 @@ public static function mask($mask, $value) /** * Creates an 'and' filter. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter,... - * @return \Zend\LDAP\Filter\AndFilter + * @param \Zend\Ldap\Filter\AbstractFilter $filter,... + * @return \Zend\Ldap\Filter\AndFilter */ public static function andFilter($filter) { @@ -213,8 +213,8 @@ public static function andFilter($filter) /** * Creates an 'or' filter. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter,... - * @return \Zend\LDAP\Filter\OrFilter + * @param \Zend\Ldap\Filter\AbstractFilter $filter,... + * @return \Zend\Ldap\Filter\OrFilter */ public static function orFilter($filter) { @@ -241,7 +241,7 @@ private static function _createFilterString($attr, $value, $filtertype, $prepend } /** - * Creates a new Zend_LDAP_Filter. + * Creates a new Zend_Ldap_Filter. * * @param string $attr * @param string $value diff --git a/library/Zend/LDAP/Filter/AbstractFilter.php b/library/Zend/Ldap/Filter/AbstractFilter.php similarity index 85% rename from library/Zend/LDAP/Filter/AbstractFilter.php rename to library/Zend/Ldap/Filter/AbstractFilter.php index 7ccf4ff30a4..23b1f69505c 100644 --- a/library/Zend/LDAP/Filter/AbstractFilter.php +++ b/library/Zend/Ldap/Filter/AbstractFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,18 +23,18 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; -use Zend\LDAP; +namespace Zend\Ldap\Filter; +use Zend\Ldap; /** - * Zend_LDAP_Filter_Abstract provides a base implementation for filters. + * Zend_Ldap_Filter_Abstract provides a base implementation for filters. * - * @uses \Zend\LDAP\Converter - * @uses \Zend\LDAP\Filter\AndFilter - * @uses \Zend\LDAP\Filter\NotFilter - * @uses \Zend\LDAP\Filter\OrFilter + * @uses \Zend\Ldap\Converter + * @uses \Zend\Ldap\Filter\AndFilter + * @uses \Zend\Ldap\Filter\NotFilter + * @uses \Zend\Ldap\Filter\OrFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -62,7 +62,7 @@ public function __toString() /** * Negates the filter. * - * @return \Zend\LDAP\Filter\AbstractFilter + * @return \Zend\Ldap\Filter\AbstractFilter */ public function negate() { @@ -72,8 +72,8 @@ public function negate() /** * Creates an 'and' filter. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter,... - * @return \Zend\LDAP\Filter\AndFilter + * @param \Zend\Ldap\Filter\AbstractFilter $filter,... + * @return \Zend\Ldap\Filter\AndFilter */ public function addAnd($filter) { @@ -85,8 +85,8 @@ public function addAnd($filter) /** * Creates an 'or' filter. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter,... - * @return \Zend\LDAP\Filter\OrFilter + * @param \Zend\Ldap\Filter\AbstractFilter $filter,... + * @return \Zend\Ldap\Filter\OrFilter */ public function addOr($filter) { @@ -115,7 +115,7 @@ public static function escapeValue($values = array()) // Escaping of filter meta characters $val = str_replace(array('\\', '*', '(', ')'), array('\5c', '\2a', '\28', '\29'), $val); // ASCII < 32 escaping - $val = LDAP\Converter::ascToHex32($val); + $val = Ldap\Converter::ascToHex32($val); if (null === $val) { $val = '\0'; // apply escaped "null" if string is empty } @@ -140,7 +140,7 @@ public static function unescapeValue($values = array()) if (!is_array($values)) $values = array($values); foreach ($values as $key => $value) { // Translate hex code into ascii - $values[$key] = LDAP\Converter::hex32ToAsc($value); + $values[$key] = Ldap\Converter::hex32ToAsc($value); } return (count($values) == 1) ? $values[0] : $values; } diff --git a/library/Zend/LDAP/Filter/AndFilter.php b/library/Zend/Ldap/Filter/AndFilter.php similarity index 87% rename from library/Zend/LDAP/Filter/AndFilter.php rename to library/Zend/Ldap/Filter/AndFilter.php index 95d70741586..7ccb33292a0 100644 --- a/library/Zend/LDAP/Filter/AndFilter.php +++ b/library/Zend/Ldap/Filter/AndFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_And provides an 'and' filter. + * Zend_Ldap_Filter_And provides an 'and' filter. * - * @uses \Zend\LDAP\Filter\LogicalFilter + * @uses \Zend\Ldap\Filter\LogicalFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Filter/Exception.php b/library/Zend/Ldap/Filter/Exception.php similarity index 92% rename from library/Zend/LDAP/Filter/Exception.php rename to library/Zend/Ldap/Filter/Exception.php index bf8d3d73a17..c790f670187 100644 --- a/library/Zend/LDAP/Filter/Exception.php +++ b/library/Zend/Ldap/Filter/Exception.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,12 +23,12 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** * @uses \Zend\Exception * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Filter/LogicalFilter.php b/library/Zend/Ldap/Filter/LogicalFilter.php similarity index 83% rename from library/Zend/LDAP/Filter/LogicalFilter.php rename to library/Zend/Ldap/Filter/LogicalFilter.php index 907588cfd76..b3af612f5aa 100644 --- a/library/Zend/LDAP/Filter/LogicalFilter.php +++ b/library/Zend/Ldap/Filter/LogicalFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,16 +23,16 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_Logical provides a base implementation for a grouping filter. + * Zend_Ldap_Filter_Logical provides a base implementation for a grouping filter. * - * @uses \Zend\LDAP\Filter\AbstractFilter - * @uses \Zend\LDAP\Filter\Exception - * @uses \Zend\LDAP\Filter\StringFilter + * @uses \Zend\Ldap\Filter\AbstractFilter + * @uses \Zend\Ldap\Filter\Exception + * @uses \Zend\Ldap\Filter\StringFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -67,7 +67,7 @@ protected function __construct(array $subfilters, $symbol) foreach ($subfilters as $key => $s) { if (is_string($s)) $subfilters[$key] = new StringFilter($s); else if (!($s instanceof AbstractFilter)) { - throw new Exception('Only strings or Zend\LDAP\Filter\AbstractFilter allowed.'); + throw new Exception('Only strings or Zend\Ldap\Filter\AbstractFilter allowed.'); } } $this->_subfilters = $subfilters; @@ -77,8 +77,8 @@ protected function __construct(array $subfilters, $symbol) /** * Adds a filter to this grouping filter. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter - * @return \Zend\LDAP\Filter\LogicalFilter + * @param \Zend\Ldap\Filter\AbstractFilter $filter + * @return \Zend\Ldap\Filter\LogicalFilter */ public function addFilter(AbstractFilter $filter) { diff --git a/library/Zend/LDAP/Filter/MaskFilter.php b/library/Zend/Ldap/Filter/MaskFilter.php similarity index 87% rename from library/Zend/LDAP/Filter/MaskFilter.php rename to library/Zend/Ldap/Filter/MaskFilter.php index e44aec6a1cb..64055ae69f4 100644 --- a/library/Zend/LDAP/Filter/MaskFilter.php +++ b/library/Zend/Ldap/Filter/MaskFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_Mask provides a simple string filter to be used with a mask. + * Zend_Ldap_Filter_Mask provides a simple string filter to be used with a mask. * - * @uses \Zend\LDAP\Filter\StringFilter + * @uses \Zend\Ldap\Filter\StringFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -38,7 +38,7 @@ class MaskFilter extends StringFilter { /** - * Creates a Zend_LDAP_Filter_String. + * Creates a Zend_Ldap_Filter_String. * * @param string $mask * @param string $value,... diff --git a/library/Zend/LDAP/Filter/NotFilter.php b/library/Zend/Ldap/Filter/NotFilter.php similarity index 80% rename from library/Zend/LDAP/Filter/NotFilter.php rename to library/Zend/Ldap/Filter/NotFilter.php index 62063e5db18..f0dd4d9d37f 100644 --- a/library/Zend/LDAP/Filter/NotFilter.php +++ b/library/Zend/Ldap/Filter/NotFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_Not provides a negation filter. + * Zend_Ldap_Filter_Not provides a negation filter. * - * @uses \Zend\LDAP\Filter\AbstractFilter + * @uses \Zend\Ldap\Filter\AbstractFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -40,14 +40,14 @@ class NotFilter extends AbstractFilter /** * The underlying filter. * - * @var \Zend\LDAP\Filter\AbstractFilter + * @var \Zend\Ldap\Filter\AbstractFilter */ private $_filter; /** - * Creates a Zend_LDAP_Filter_Not. + * Creates a Zend_Ldap_Filter_Not. * - * @param \Zend\LDAP\Filter\AbstractFilter $filter + * @param \Zend\Ldap\Filter\AbstractFilter $filter */ public function __construct(AbstractFilter $filter) { @@ -57,7 +57,7 @@ public function __construct(AbstractFilter $filter) /** * Negates the filter. * - * @return \Zend\LDAP\Filter\AbstractFilter + * @return \Zend\Ldap\Filter\AbstractFilter */ public function negate() { diff --git a/library/Zend/LDAP/Filter/OrFilter.php b/library/Zend/Ldap/Filter/OrFilter.php similarity index 87% rename from library/Zend/LDAP/Filter/OrFilter.php rename to library/Zend/Ldap/Filter/OrFilter.php index 128bb2cdd19..841245b4787 100644 --- a/library/Zend/LDAP/Filter/OrFilter.php +++ b/library/Zend/Ldap/Filter/OrFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_Or provides an 'or' filter. + * Zend_Ldap_Filter_Or provides an 'or' filter. * - * @uses \Zend\LDAP\Filter\LogicalFilter + * @uses \Zend\Ldap\Filter\LogicalFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Filter/StringFilter.php b/library/Zend/Ldap/Filter/StringFilter.php similarity index 85% rename from library/Zend/LDAP/Filter/StringFilter.php rename to library/Zend/Ldap/Filter/StringFilter.php index 53c18abe9ab..95640368403 100644 --- a/library/Zend/LDAP/Filter/StringFilter.php +++ b/library/Zend/Ldap/Filter/StringFilter.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\LDAP\Filter; +namespace Zend\Ldap\Filter; /** - * Zend_LDAP_Filter_String provides a simple custom string filter. + * Zend_Ldap_Filter_String provides a simple custom string filter. * - * @uses \Zend\LDAP\Filter\AbstractFilter + * @uses \Zend\Ldap\Filter\AbstractFilter * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Filter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -45,7 +45,7 @@ class StringFilter extends AbstractFilter protected $_filter; /** - * Creates a Zend_LDAP_Filter_String. + * Creates a Zend_Ldap_Filter_String. * * @param string $filter */ diff --git a/library/Zend/LDAP/LDAP.php b/library/Zend/Ldap/Ldap.php similarity index 87% rename from library/Zend/LDAP/LDAP.php rename to library/Zend/Ldap/Ldap.php index e013cd7cf2f..e9cf9c00404 100644 --- a/library/Zend/LDAP/LDAP.php +++ b/library/Zend/Ldap/Ldap.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -22,23 +22,23 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * @uses \Zend\LDAP\Collection - * @uses \Zend\LDAP\Collection\DefaultIterator - * @uses \Zend\LDAP\DN - * @uses \Zend\LDAP\Exception - * @uses \Zend\LDAP\Filter\AbstractFilter - * @uses \Zend\LDAP\Node - * @uses \Zend\LDAP\Node\RootDSE - * @uses \Zend\LDAP\Node\Schema + * @uses \Zend\Ldap\Collection + * @uses \Zend\Ldap\Collection\DefaultIterator + * @uses \Zend\Ldap\Dn + * @uses \Zend\Ldap\Exception + * @uses \Zend\Ldap\Filter\AbstractFilter + * @uses \Zend\Ldap\Node + * @uses \Zend\Ldap\Node\RootDSE + * @uses \Zend\Ldap\Node\Schema * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class LDAP +class Ldap { const SEARCH_SCOPE_SUB = 1; const SEARCH_SCOPE_ONE = 2; @@ -82,19 +82,19 @@ class LDAP /** * Caches the RootDSE * - * @var \Zend\LDAP\Node + * @var \Zend\Ldap\Node */ protected $_rootDse = null; /** * Caches the schema * - * @var \Zend\LDAP\Node + * @var \Zend\Ldap\Node */ protected $_schema = null; /** - * @deprecated will be removed, use {@see Zend_LDAP_Filter_Abstract::escapeValue()} + * @deprecated will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()} * @param string $str The string to escape. * @return string The escaped string */ @@ -104,7 +104,7 @@ public static function filterEscape($str) } /** - * @deprecated will be removed, use {@see Zend_LDAP_Dn::checkDn()} + * @deprecated will be removed, use {@see Zend_Ldap_Dn::checkDn()} * @param string $dn The DN to parse * @param array $keys An optional array to receive DN keys (e.g. CN, OU, DC, ...) * @param array $vals An optional array to receive DN values @@ -121,7 +121,7 @@ public static function explodeDn($dn, array &$keys = null, array &$vals = null) * * @param array|\Zend\Config\Config $options Options used in connecting, binding, etc. * @return void - * @throws \Zend\LDAP\Exception if ext/ldap is not installed + * @throws \Zend\Ldap\Exception if ext/ldap is not installed */ public function __construct($options = array()) { @@ -251,8 +251,8 @@ public function getBoundUser() * tryUsernameSplit * * @param array|\Zend\Config\Config $options Options used in connecting, binding, etc. - * @return \Zend\LDAP\LDAP Provides a fluent interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluent interface + * @throws \Zend\Ldap\Exception */ public function setOptions($options) { @@ -307,7 +307,7 @@ public function setOptions($options) } if (count($options) > 0) { $key = key($options); - throw new Exception(null, "Unknown Zend_LDAP option: $key"); + throw new Exception(null, "Unknown Zend_Ldap option: $key"); } $this->_options = $permittedOptions; return $this; @@ -396,11 +396,11 @@ protected function _getAccountCanonicalForm() $accountDomainName = $this->_getAccountDomainName(); $accountDomainNameShort = $this->_getAccountDomainNameShort(); if ($accountDomainNameShort) { - $accountCanonicalForm = LDAP::ACCTNAME_FORM_BACKSLASH; + $accountCanonicalForm = Ldap::ACCTNAME_FORM_BACKSLASH; } else if ($accountDomainName) { - $accountCanonicalForm = LDAP::ACCTNAME_FORM_PRINCIPAL; + $accountCanonicalForm = Ldap::ACCTNAME_FORM_PRINCIPAL; } else { - $accountCanonicalForm = LDAP::ACCTNAME_FORM_USERNAME; + $accountCanonicalForm = Ldap::ACCTNAME_FORM_USERNAME; } } @@ -513,14 +513,14 @@ protected function _splitName($name, &$dname, &$aname) /** * @param string $acctname The name of the account * @return string The DN of the specified account - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _getAccountDn($acctname) { if (DN::checkDn($acctname)) { return $acctname; } - $acctname = $this->getCanonicalAccountName($acctname, LDAP::ACCTNAME_FORM_USERNAME); + $acctname = $this->getCanonicalAccountName($acctname, Ldap::ACCTNAME_FORM_USERNAME); $acct = $this->_getAccount($acctname, array('dn')); return $acct['dn']; } @@ -552,7 +552,7 @@ protected function _isPossibleAuthority($dname) * @param string $acctname The name to canonicalize * @param int $type The desired form of canonicalization * @return string The canonicalized name in the desired form - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function getCanonicalAccountName($acctname, $form = 0) { @@ -579,17 +579,17 @@ public function getCanonicalAccountName($acctname, $form = 0) } switch ($form) { - case LDAP::ACCTNAME_FORM_DN: + case Ldap::ACCTNAME_FORM_DN: return $this->_getAccountDn($acctname); - case LDAP::ACCTNAME_FORM_USERNAME: + case Ldap::ACCTNAME_FORM_USERNAME: return $uname; - case LDAP::ACCTNAME_FORM_BACKSLASH: + case Ldap::ACCTNAME_FORM_BACKSLASH: $accountDomainNameShort = $this->_getAccountDomainNameShort(); if (!$accountDomainNameShort) { throw new Exception(null, 'Option required: accountDomainNameShort'); } return "$accountDomainNameShort\\$uname"; - case LDAP::ACCTNAME_FORM_PRINCIPAL: + case Ldap::ACCTNAME_FORM_PRINCIPAL: $accountDomainName = $this->_getAccountDomainName(); if (!$accountDomainName) { throw new Exception(null, 'Option required: accountDomainName'); @@ -603,7 +603,7 @@ public function getCanonicalAccountName($acctname, $form = 0) /** * @param array $attrs An array of names of desired attributes * @return array An array of the attributes representing the account - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _getAccount($acctname, array $attrs = null) { @@ -639,7 +639,7 @@ protected function _getAccount($acctname, array $attrs = null) } /** - * @return \Zend\LDAP\LDAP Provides a fluent interface + * @return \Zend\Ldap\Ldap Provides a fluent interface */ public function disconnect() { @@ -662,8 +662,8 @@ public function disconnect() * @param int $port The port number of the LDAP server to connect to * @param boolean $useSsl Use SSL * @param boolean $useStartTls Use STARTTLS - * @return \Zend\LDAP\LDAP Provides a fluent interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluent interface + * @throws \Zend\Ldap\Exception */ public function connect($host = null, $port = null, $useSsl = null, $useStartTls = null) { @@ -741,8 +741,8 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls /** * @param string $username The username for authenticating the bind * @param string $password The password for authenticating the bind - * @return \Zend\LDAP\LDAP Provides a fluent interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluent interface + * @throws \Zend\Ldap\Exception */ public function bind($username = null, $password = null) { @@ -832,14 +832,14 @@ public function bind($username = null, $password = null) * - sort * - collectionClass * - * @param string|\Zend\LDAP\Filter\AbstractFilter|array $filter - * @param string|\Zend\LDAP\DN|null $basedn + * @param string|\Zend\Ldap\Filter\AbstractFilter|array $filter + * @param string|\Zend\Ldap\Dn|null $basedn * @param integer $scope * @param array $attributes * @param string|null $sort * @param string|null $collectionClass - * @return \Zend\LDAP\Collection - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Collection + * @throws \Zend\Ldap\Exception */ public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), $sort = null, $collectionClass = null) @@ -907,10 +907,10 @@ public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, /** * Extension point for collection creation * - * @param \Zend\LDAP\Collection\DefaultIterator $iterator + * @param \Zend\Ldap\Collection\DefaultIterator $iterator * @param string|null $collectionClass - * @return \Zend\LDAP\Collection - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Collection + * @throws \Zend\Ldap\Exception */ protected function _createCollection(Collection\DefaultIterator $iterator, $collectionClass) { @@ -922,9 +922,9 @@ protected function _createCollection(Collection\DefaultIterator $iterator, $coll throw new Exception(null, "Class '$collectionClass' can not be found"); } - if (!is_subclass_of($collectionClass, 'Zend\LDAP\Collection')) { + if (!is_subclass_of($collectionClass, 'Zend\Ldap\Collection')) { throw new Exception(null, - "Class '$collectionClass' must subclass 'Zend\LDAP\Collection'"); + "Class '$collectionClass' must subclass 'Zend\Ldap\Collection'"); } return new $collectionClass($iterator); } @@ -933,11 +933,11 @@ protected function _createCollection(Collection\DefaultIterator $iterator, $coll /** * Count items found by given filter. * - * @param string|\Zend\LDAP\Filter\AbstractFilter $filter - * @param string|\Zend\LDAP\DN|null $basedn + * @param string|\Zend\Ldap\Filter\AbstractFilter $filter + * @param string|\Zend\Ldap\Dn|null $basedn * @param integer $scope * @return integer - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function count($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB) { @@ -953,9 +953,9 @@ public function count($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB) /** * Count children for a given DN. * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @return integer - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function countChildren($dn) { @@ -965,9 +965,9 @@ public function countChildren($dn) /** * Check if a given DN exists. * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function exists($dn) { @@ -986,14 +986,14 @@ public function exists($dn) * - sort * - reverseSort * - * @param string|\Zend\LDAP\Filter\AbstractFilter|array $filter - * @param string|\Zend\LDAP\DN|null $basedn + * @param string|\Zend\Ldap\Filter\AbstractFilter|array $filter + * @param string|\Zend\Ldap\Dn|null $basedn * @param integer $scope * @param array $attributes * @param string|null $sort * @param boolean $reverseSort * @return array - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function searchEntries($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), $sort = null, $reverseSort = false) @@ -1019,11 +1019,11 @@ public function searchEntries($filter, $basedn = null, $scope = self::SEARCH_SCO /** * Get LDAP entry by DN * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @param array $attributes * @param boolean $throwOnNotFound * @return array - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function getEntry($dn, array $attributes = array(), $throwOnNotFound = false) { @@ -1044,7 +1044,7 @@ public function getEntry($dn, array $attributes = array(), $throwOnNotFound = fa * @return void * @throws InvalidArgumentException */ - public static function prepareLDAPEntryArray(array &$entry) + public static function prepareLdapEntryArray(array &$entry) { if (array_key_exists('dn', $entry)) unset($entry['dn']); foreach ($entry as $key => $value) { @@ -1083,17 +1083,17 @@ public static function prepareLDAPEntryArray(array &$entry) /** * Add new information to the LDAP repository * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @param array $entry - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function add($dn, array $entry) { if (!($dn instanceof DN)) { $dn = DN::factory($dn, null); } - self::prepareLDAPEntryArray($entry); + self::prepareLdapEntryArray($entry); foreach ($entry as $key => $value) { if (is_array($value) && count($value) === 0) { unset($entry[$key]); @@ -1127,21 +1127,21 @@ public function add($dn, array $entry) /** * Update LDAP registry * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @param array $entry - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function update($dn, array $entry) { if (!($dn instanceof DN)) { $dn = DN::factory($dn, null); } - self::prepareLDAPEntryArray($entry); + self::prepareLdapEntryArray($entry); $rdnParts = $dn->getRdn(DN::ATTR_CASEFOLD_LOWER); foreach ($rdnParts as $key => $value) { - $value = Zend_Ldap_Dn::unescapeValue($value); + $value = Dn::unescapeValue($value); if (array_key_exists($key, $entry) && !in_array($value, $entry[$key])) { $entry[$key] = array_merge(array($value), $entry[$key]); } @@ -1169,10 +1169,10 @@ public function update($dn, array $entry) * Internally decides if entry will be updated to added by calling * {@link exists()}. * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @param array $entry - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function save($dn, array $entry) { @@ -1187,10 +1187,10 @@ public function save($dn, array $entry) /** * Delete an LDAP entry * - * @param string|\Zend\LDAP\DN $dn + * @param string|\Zend\Ldap\Dn $dn * @param boolean $recursively - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function delete($dn, $recursively = false) { @@ -1218,7 +1218,7 @@ public function delete($dn, $recursively = false) * This method is used in recursive methods like {@see delete()} * or {@see copy()} * - * @param string|\Zend\LDAP\DN $parentDn + * @param string|\Zend\Ldap\Dn $parentDn * @return array of DNs */ protected function _getChildrenDns($parentDn) @@ -1244,12 +1244,12 @@ protected function _getChildrenDns($parentDn) /** * Moves a LDAP entry from one DN to another subtree. * - * @param string|\Zend\LDAP\DN $from - * @param string|\Zend\LDAP\DN $to + * @param string|\Zend\Ldap\Dn $from + * @param string|\Zend\Ldap\Dn $to * @param boolean $recursively * @param boolean $alwaysEmulate - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function moveToSubtree($from, $to, $recursively = false, $alwaysEmulate = false) { @@ -1275,12 +1275,12 @@ public function moveToSubtree($from, $to, $recursively = false, $alwaysEmulate = * * This is an alias for {@link rename()} * - * @param string|\Zend\LDAP\DN $from - * @param string|\Zend\LDAP\DN $to + * @param string|\Zend\Ldap\Dn $from + * @param string|\Zend\Ldap\Dn $to * @param boolean $recursively * @param boolean $alwaysEmulate - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function move($from, $to, $recursively = false, $alwaysEmulate = false) { @@ -1292,12 +1292,12 @@ public function move($from, $to, $recursively = false, $alwaysEmulate = false) * * This method implicitely moves the entry to another location within the tree. * - * @param string|\Zend\LDAP\DN $from - * @param string|\Zend\LDAP\DN $to + * @param string|\Zend\Ldap\Dn $from + * @param string|\Zend\Ldap\Dn $to * @param boolean $recursively * @param boolean $alwaysEmulate - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function rename($from, $to, $recursively = false, $alwaysEmulate = false) { @@ -1334,11 +1334,11 @@ public function rename($from, $to, $recursively = false, $alwaysEmulate = false) /** * Copies a LDAP entry from one DN to another subtree. * - * @param string|\Zend\LDAP\DN $from - * @param string|\Zend\LDAP\DN $to + * @param string|\Zend\Ldap\Dn $from + * @param string|\Zend\Ldap\Dn $to * @param boolean $recursively - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function copyToSubtree($from, $to, $recursively = false) { @@ -1362,11 +1362,11 @@ public function copyToSubtree($from, $to, $recursively = false) /** * Copies a LDAP entry from one DN to another DN. * - * @param string|\Zend\LDAP\DN $from - * @param string|\Zend\LDAP\DN $to + * @param string|\Zend\Ldap\Dn $from + * @param string|\Zend\Ldap\Dn $to * @param boolean $recursively - * @return \Zend\LDAP\LDAP Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function copy($from, $to, $recursively = false) { @@ -1392,22 +1392,22 @@ public function copy($from, $to, $recursively = false) } /** - * Returns the specified DN as a Zend_LDAP_Node + * Returns the specified DN as a Zend_Ldap_Node * - * @param string|\Zend\LDAP\DN $dn - * @return \Zend\LDAP\Node|null - * @throws \Zend\LDAP\Exception + * @param string|\Zend\Ldap\dN $dn + * @return \Zend\Ldap\Node|null + * @throws \Zend\Ldap\Exception */ public function getNode($dn) { - return Node::fromLDAP($dn, $this); + return Node::fromLdap($dn, $this); } /** - * Returns the base node as a Zend_LDAP_Node + * Returns the base node as a Zend_Ldap_Node * - * @return \Zend\LDAP\Node - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node + * @throws \Zend\Ldap\Exception */ public function getBaseNode() { @@ -1417,8 +1417,8 @@ public function getBaseNode() /** * Returns the RootDSE * - * @return \Zend\LDAP\Node\RootDSE - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node\RootDSE + * @throws \Zend\Ldap\Exception */ public function getRootDse() { @@ -1431,8 +1431,8 @@ public function getRootDse() /** * Returns the schema * - * @return \Zend\LDAP\Node\Schema - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node\Schema + * @throws \Zend\Ldap\Exception */ public function getSchema() { diff --git a/library/Zend/LDAP/LDIF/Encoder.php b/library/Zend/Ldap/Ldif/Encoder.php similarity index 95% rename from library/Zend/LDAP/LDIF/Encoder.php rename to library/Zend/Ldap/Ldif/Encoder.php index 6653752f837..01944f20ac6 100644 --- a/library/Zend/LDAP/LDIF/Encoder.php +++ b/library/Zend/Ldap/Ldif/Encoder.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Ldif * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,13 +23,13 @@ /** * @namespace */ -namespace Zend\LDAP\LDIF; +namespace Zend\Ldap\Ldif; /** - * Zend_LDAP_Ldif_Encoder provides methods to encode and decode LDAP data into/from LDIF. + * Zend_Ldap_Ldif_Encoder provides methods to encode and decode LDAP data into/from Ldif. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Ldif * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -64,7 +64,7 @@ protected function __construct(array $options = array()) } /** - * Decodes the string $string into an array of LDIF items + * Decodes the string $string into an array of Ldif items * * @param string $string * @return array @@ -76,7 +76,7 @@ public static function decode($string) } /** - * Decodes the string $string into an array of LDIF items + * Decodes the string $string into an array of Ldif items * * @param string $string * @return array @@ -143,7 +143,7 @@ protected function _pushAttribute(array $attribute, array &$entry) } /** - * Encode $value into a LDIF representation + * Encode $value into a Ldif representation * * @param mixed $value The value to be encoded * @param array $options Additional options used during encoding @@ -168,7 +168,7 @@ protected function _encode($value) return $this->_encodeString($value); } else if (is_array($value)) { return $this->_encodeAttributes($value); - } else if ($value instanceof \Zend\LDAP\Node) { + } else if ($value instanceof \Zend\Ldap\Node) { return $value->toLdif($this->_options); } return null; diff --git a/library/Zend/LDAP/Node.php b/library/Zend/Ldap/Node.php similarity index 77% rename from library/Zend/LDAP/Node.php rename to library/Zend/Ldap/Node.php index be7e1bd3366..4bad5a64892 100644 --- a/library/Zend/LDAP/Node.php +++ b/library/Zend/Ldap/Node.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,21 +23,21 @@ /** * @namespace */ -namespace Zend\LDAP; +namespace Zend\Ldap; /** - * Zend_LDAP_Node provides an object oriented view into a LDAP node. + * Zend_Ldap_Node provides an object oriented view into a LDAP node. * - * @uses \Zend\LDAP\LDAP - * @uses \Zend\LDAP\Attribute - * @uses \Zend\LDAP\DN - * @uses \Zend\LDAP\Exception - * @uses \Zend\LDAP\LDIF\Encoder - * @uses \Zend\LDAP\Node\AbstractNode - * @uses \Zend\LDAP\Node\ChildrenIterator - * @uses \Zend\LDAP\Node\Collection + * @uses \Zend\Ldap\Ldap + * @uses \Zend\Ldap\Attribute + * @uses \Zend\Ldap\Dn + * @uses \Zend\Ldap\Exception + * @uses \Zend\Ldap\Ldif\Encoder + * @uses \Zend\Ldap\Node\AbstractNode + * @uses \Zend\Ldap\Node\ChildrenIterator + * @uses \Zend\Ldap\Node\Collection * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -45,9 +45,9 @@ class Node extends Node\AbstractNode implements \Iterator, \RecursiveIterator { /** - * Holds the node's new DN if node is renamed. + * Holds the node's new Dn if node is renamed. * - * @var \Zend\LDAP\DN + * @var \Zend\Ldap\Dn */ protected $_newDn; /** @@ -71,7 +71,7 @@ class Node extends Node\AbstractNode implements \Iterator, \RecursiveIterator /** * Holds the connection to the LDAP server if in connected mode. * - * @var \Zend\LDAP\LDAP + * @var \Zend\Ldap\Ldap */ protected $_ldap; @@ -94,23 +94,23 @@ class Node extends Node\AbstractNode implements \Iterator, \RecursiveIterator * * Constructor is protected to enforce the use of factory methods. * - * @param \Zend\LDAP\DN $dn + * @param \Zend\Ldap\Dn $dn * @param array $data * @param boolean $fromDataSource - * @param \Zend\LDAP\LDAP $ldap - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @throws \Zend\Ldap\Exception */ - protected function __construct(DN $dn, array $data, $fromDataSource, LDAP $ldap = null) + protected function __construct(Dn $dn, array $data, $fromDataSource, Ldap $ldap = null) { parent::__construct($dn, $data, $fromDataSource); - if (!is_null($ldap)) $this->attachLDAP($ldap); - else $this->detachLDAP(); + if (!is_null($ldap)) $this->attachLdap($ldap); + else $this->detachLdap(); } /** * Serialization callback * - * Only DN and attributes will be serialized. + * Only Dn and attributes will be serialized. * * @return array */ @@ -129,16 +129,16 @@ public function __sleep() */ public function __wakeup() { - $this->detachLDAP(); + $this->detachLdap(); } /** * Gets the current LDAP connection. * - * @return \Zend\LDAP\LDAP - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Ldap + * @throws \Zend\Ldap\Exception */ - public function getLDAP() + public function getLdap() { if (is_null($this->_ldap)) { throw new Exception(null, 'No LDAP connection specified.', Exception::LDAP_OTHER); @@ -151,14 +151,14 @@ public function getLDAP() * * This is an offline method. * - * @uses \Zend\LDAP\DN::isChildOf() - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @uses \Zend\Ldap\Dn::isChildOf() + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ - public function attachLDAP(LDAP $ldap) + public function attachLdap(Ldap $ldap) { - if (!DN::isChildOf($this->_getDn(), $ldap->getBaseDn())) { + if (!Dn::isChildOf($this->_getDn(), $ldap->getBaseDn())) { throw new Exception(null, 'LDAP connection is not responsible for given node.', Exception::LDAP_OTHER); } @@ -167,7 +167,7 @@ public function attachLDAP(LDAP $ldap) $this->_ldap = $ldap; if (is_array($this->_children)) { foreach ($this->_children as $child) { - $child->attachLDAP($ldap); + $child->attachLdap($ldap); } } } @@ -179,14 +179,14 @@ public function attachLDAP(LDAP $ldap) * * This is an offline method. * - * @return \Zend\LDAP\Node Provides a fluid interface + * @return \Zend\Ldap\Node Provides a fluid interface */ - public function detachLDAP() + public function detachLdap() { $this->_ldap = null; if (is_array($this->_children)) { foreach ($this->_children as $child) { - $child->detachLDAP(); + $child->detachLdap(); } } return $this; @@ -207,7 +207,7 @@ public function isAttached() /** * @param array $data * @param boolean $fromDataSource - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _loadData(array $data, $fromDataSource) { @@ -223,18 +223,18 @@ protected function _loadData(array $data, $fromDataSource) } /** - * Factory method to create a new detached Zend_LDAP_Node for a given DN. + * Factory method to create a new detached Zend_Ldap_Node for a given DN. * - * @param string|array|\Zend\LDAP\DN $dn + * @param string|array|\Zend\Ldap\Dn $dn * @param array $objectClass - * @return \Zend\LDAP\Node - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node + * @throws \Zend\Ldap\Exception */ public static function create($dn, array $objectClass = array()) { if (is_string($dn) || is_array($dn)) { - $dn = DN::factory($dn); - } else if ($dn instanceof DN) { + $dn = Dn::factory($dn); + } else if ($dn instanceof Dn) { $dn = clone $dn; } else { throw new Exception(null, '$dn is of a wrong data type.'); @@ -246,18 +246,18 @@ public static function create($dn, array $objectClass = array()) } /** - * Factory method to create an attached Zend_LDAP_Node for a given DN. + * Factory method to create an attached Zend_Ldap_Node for a given DN. * - * @param string|array|\Zend\LDAP\DN $dn - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node|null - * @throws \Zend\LDAP\Exception + * @param string|array|\Zend\Ldap\Dn $dn + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node|null + * @throws \Zend\Ldap\Exception */ - public static function fromLDAP($dn, LDAP $ldap) + public static function fromLdap($dn, Ldap $ldap) { if (is_string($dn) || is_array($dn)) { - $dn = DN::factory($dn); - } else if ($dn instanceof DN) { + $dn = Dn::factory($dn); + } else if ($dn instanceof Dn) { $dn = clone $dn; } else { throw new Exception(null, '$dn is of a wrong data type.'); @@ -271,12 +271,12 @@ public static function fromLDAP($dn, LDAP $ldap) } /** - * Factory method to create a detached Zend_LDAP_Node from array data. + * Factory method to create a detached Zend_Ldap_Node from array data. * * @param array $data * @param boolean $fromDataSource - * @return \Zend\LDAP\Node - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node + * @throws \Zend\Ldap\Exception */ public static function fromArray(array $data, $fromDataSource = false) { @@ -284,8 +284,8 @@ public static function fromArray(array $data, $fromDataSource = false) throw new Exception(null, '\'dn\' key is missing in array.'); } if (is_string($data['dn']) || is_array($data['dn'])) { - $dn = DN::factory($data['dn']); - } else if ($data['dn'] instanceof DN) { + $dn = Dn::factory($data['dn']); + } else if ($data['dn'] instanceof Dn) { $dn = clone $data['dn']; } else { throw new Exception(null, '\'dn\' key is of a wrong data type.'); @@ -361,7 +361,7 @@ public function willBeDeleted() * * Node will be deleted on calling update() if $delete is true. * - * @return \Zend\LDAP\Node Provides a fluid interface + * @return \Zend\Ldap\Node Provides a fluid interface */ public function delete() { @@ -388,17 +388,17 @@ public function willBeMoved() /** * Sends all pending changes to the LDAP server * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ - public function update(LDAP $ldap = null) + public function update(Ldap $ldap = null) { if ($ldap !== null) { - $this->attachLDAP($ldap); + $this->attachLdap($ldap); } - $ldap = $this->getLDAP(); - if (!($ldap instanceof LDAP)) { + $ldap = $this->getLdap(); + if (!($ldap instanceof Ldap)) { throw new Exception(null, 'No LDAP connection available'); } @@ -436,11 +436,11 @@ public function update(LDAP $ldap = null) } /** - * Gets the DN of the current node as a Zend_LDAP_Dn. + * Gets the DN of the current node as a Zend_Ldap_Dn. * * This is an offline method. * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ protected function _getDn() { @@ -448,12 +448,12 @@ protected function _getDn() } /** - * Gets the current DN of the current node as a Zend_LDAP_Dn. + * Gets the current DN of the current node as a Zend_Ldap_Dn. * The method returns a clone of the node's DN to prohibit modification. * * This is an offline method. * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ public function getCurrentDn() { @@ -466,16 +466,16 @@ public function getCurrentDn() * * This is an offline method. * - * @param \Zend\LDAP\DN|string|array $newDn - * @throws \Zend\LDAP\Exception - * @return \Zend\LDAP\Node Provides a fluid interface + * @param \Zend\Ldap\Dn|string|array $newDn + * @throws \Zend\Ldap\Exception + * @return \Zend\Ldap\Node Provides a fluid interface */ public function setDn($newDn) { - if ($newDn instanceof DN) { + if ($newDn instanceof Dn) { $this->_newDn = clone $newDn; } else { - $this->_newDn = DN::factory($newDn); + $this->_newDn = Dn::factory($newDn); } $this->_ensureRdnAttributeValues(); return $this; @@ -486,9 +486,9 @@ public function setDn($newDn) * * This is an offline method. * - * @param \Zend\LDAP\DN|string|array $newDn - * @throws \Zend\LDAP\Exception - * @return \Zend\LDAP\Node Provides a fluid interface + * @param \Zend\Ldap\Dn|string|array $newDn + * @throws \Zend\Ldap\Exception + * @return \Zend\Ldap\Node Provides a fluid interface */ public function move($newDn) { @@ -500,9 +500,9 @@ public function move($newDn) * * This is an offline method. * - * @param \Zend\LDAP\DN|string|array $newDn - * @throws \Zend\LDAP\Exception - * @return \Zend\LDAP\Node Provides a fluid interface + * @param \Zend\Ldap\Dn|string|array $newDn + * @throws \Zend\Ldap\Exception + * @return \Zend\Ldap\Node Provides a fluid interface */ public function rename($newDn) { @@ -515,8 +515,8 @@ public function rename($newDn) * This is an offline method. * * @param array|string $value - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function setObjectClass($value) { @@ -530,8 +530,8 @@ public function setObjectClass($value) * This is an offline method. * * @param array|string $value - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function appendObjectClass($value) { @@ -548,14 +548,14 @@ public function appendObjectClass($value) public function toLdif(array $options = array()) { $attributes = array_merge(array('dn' => $this->getDnString()), $this->getData(false)); - return LDIF\Encoder::encode($attributes, $options); + return Ldif\Encoder::encode($attributes, $options); } /** * Gets changed node data. * * The array contains all changed attributes. - * This format can be used in {@link Zend_LDAP::add()} and {@link Zend_LDAP::update()}. + * This format can be used in {@link Zend_Ldap::add()} and {@link Zend_Ldap::update()}. * * This is an offline method. * @@ -610,8 +610,8 @@ public function getChanges() * * @param string $name * @param mixed $value - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function setAttribute($name, $value) { @@ -626,8 +626,8 @@ public function setAttribute($name, $value) * * @param string $name * @param mixed $value - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function appendToAttribute($name, $value) { @@ -641,7 +641,7 @@ public function appendToAttribute($name, $value) * @param string $name * @param mixed $value * @param boolean $append - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _setAttribute($name, $value, $append) { @@ -657,8 +657,8 @@ protected function _setAttribute($name, $value, $append) * @param string $name * @param integer|array $value * @param boolean $utc - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function setDateTimeAttribute($name, $value, $utc = false) { @@ -674,8 +674,8 @@ public function setDateTimeAttribute($name, $value, $utc = false) * @param string $name * @param integer|array $value * @param boolean $utc - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function appendToDateTimeAttribute($name, $value, $utc = false) { @@ -690,7 +690,7 @@ public function appendToDateTimeAttribute($name, $value, $utc = false) * @param integer|array $value * @param boolean $utc * @param boolean $append - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _setDateTimeAttribute($name, $value, $utc, $append) { @@ -704,8 +704,8 @@ protected function _setDateTimeAttribute($name, $value, $utc, $append) * @param string $password * @param string $hashType * @param string $attribName - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function setPasswordAttribute($password, $hashType = Attribute::PASSWORD_HASH_MD5, $attribName = 'userPassword') @@ -723,8 +723,8 @@ public function setPasswordAttribute($password, $hashType = Attribute::PASSWORD_ * This is an offline method. * * @param string $name - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ public function deleteAttribute($name) { @@ -760,12 +760,12 @@ public function removeFromAttribute($attribName, $value) /** * @param string $name * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _assertChangeableAttribute($name) { $name = strtolower($name); - $rdn = $this->getRdnArray(DN::ATTR_CASEFOLD_LOWER); + $rdn = $this->getRdnArray(Dn::ATTR_CASEFOLD_LOWER); if ($name == 'dn') { throw new Exception(null, 'DN cannot be changed.'); } @@ -785,7 +785,7 @@ protected function _assertChangeableAttribute($name) * @param string $name * @param mixed $value * @return null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function __set($name, $value) { @@ -801,7 +801,7 @@ public function __set($name, $value) * * @param string $name * @return null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function __unset($name) { @@ -817,7 +817,7 @@ public function __unset($name) * @param string $name * @param mixed $value * @return null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function offsetSet($name, $value) { @@ -834,7 +834,7 @@ public function offsetSet($name, $value) * * @param string $name * @return null - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function offsetUnset($name) { @@ -846,16 +846,16 @@ public function offsetUnset($name) * * This is an online method. * - * @param \Zend\LDAP\LDAP $ldap + * @param \Zend\Ldap\Ldap $ldap * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ - public function exists(LDAP $ldap = null) + public function exists(Ldap $ldap = null) { if ($ldap !== null) { - $this->attachLDAP($ldap); + $this->attachLdap($ldap); } - $ldap = $this->getLDAP(); + $ldap = $this->getLdap(); return $ldap->exists($this->_getDn()); } @@ -864,16 +864,16 @@ public function exists(LDAP $ldap = null) * * This is an online method. * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node Provides a fluid interface + * @throws \Zend\Ldap\Exception */ - public function reload(LDAP $ldap = null) + public function reload(Ldap $ldap = null) { if ($ldap !== null) { - $this->attachLDAP($ldap); + $this->attachLdap($ldap); } - $ldap = $this->getLDAP(); + $ldap = $this->getLdap(); parent::reload($ldap); return $this; } @@ -883,16 +883,16 @@ public function reload(LDAP $ldap = null) * * This is an online method. * - * @param string|\Zend\LDAP\Filter\AbstractFilter $filter + * @param string|\Zend\Ldap\Filter\AbstractFilter $filter * @param integer $scope * @param string $sort - * @return \Zend\LDAP\Node\Collection - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node\Collection + * @throws \Zend\Ldap\Exception */ - public function searchSubtree($filter, $scope = LDAP::SEARCH_SCOPE_SUB, $sort = null) + public function searchSubtree($filter, $scope = Ldap::SEARCH_SCOPE_SUB, $sort = null) { - return $this->getLDAP()->search($filter, $this->_getDn(), $scope, array('*', '+'), $sort, - 'Zend\LDAP\Node\Collection'); + return $this->getLdap()->search($filter, $this->_getDn(), $scope, array('*', '+'), $sort, + 'Zend\Ldap\Node\Collection'); } /** @@ -900,14 +900,14 @@ public function searchSubtree($filter, $scope = LDAP::SEARCH_SCOPE_SUB, $sort = * * This is an online method. * - * @param string|\Zend\LDAP\Filter\AbstractFilter $filter + * @param string|\Zend\Ldap\Filter\AbstractFilter $filter * @param integer $scope * @return integer - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ - public function countSubtree($filter, $scope = LDAP::SEARCH_SCOPE_SUB) + public function countSubtree($filter, $scope = Ldap::SEARCH_SCOPE_SUB) { - return $this->getLDAP()->count($filter, $this->_getDn(), $scope); + return $this->getLdap()->count($filter, $this->_getDn(), $scope); } /** @@ -916,11 +916,11 @@ public function countSubtree($filter, $scope = LDAP::SEARCH_SCOPE_SUB) * This is an online method. * * @return integer - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function countChildren() { - return $this->countSubtree('(objectClass=*)', LDAP::SEARCH_SCOPE_ONE); + return $this->countSubtree('(objectClass=*)', Ldap::SEARCH_SCOPE_ONE); } /** @@ -928,14 +928,14 @@ public function countChildren() * * This is an online method. * - * @param string|\Zend\LDAP\Filter\AbstractFilter $filter + * @param string|\Zend\Ldap\Filter\AbstractFilter $filter * @param string $sort - * @return \Zend\LDAP\Node\Collection - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node\Collection + * @throws \Zend\Ldap\Exception */ public function searchChildren($filter, $sort = null) { - return $this->searchSubtree($filter, LDAP::SEARCH_SCOPE_ONE, $sort); + return $this->searchSubtree($filter, Ldap::SEARCH_SCOPE_ONE, $sort); } /** @@ -945,7 +945,7 @@ public function searchChildren($filter, $sort = null) * Can be used offline but returns false if children have not been retrieved yet. * * @return boolean - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function hasChildren() { @@ -965,8 +965,8 @@ public function hasChildren() * * Can be used offline but returns an empty array if children have not been retrieved yet. * - * @return \Zend\LDAP\Node\ChildrenIterator - * @throws \Zend\LDAP\Exception + * @return \Zend\Ldap\Node\ChildrenIterator + * @throws \Zend\Ldap\Exception */ public function getChildren() { @@ -975,7 +975,7 @@ public function getChildren() if ($this->isAttached()) { $children = $this->searchChildren('(objectClass=*)', null); foreach ($children as $child) { - $this->_children[$child->getRdnString(DN::ATTR_CASEFOLD_LOWER)] = $child; + $this->_children[$child->getRdnString(Dn::ATTR_CASEFOLD_LOWER)] = $child; } } } @@ -985,18 +985,18 @@ public function getChildren() /** * Returns the parent of the current node. * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node + * @throws \Zend\Ldap\Exception */ - public function getParent(LDAP $ldap = null) + public function getParent(Ldap $ldap = null) { if ($ldap !== null) { - $this->attachLDAP($ldap); + $this->attachLdap($ldap); } - $ldap = $this->getLDAP(); + $ldap = $this->getLdap(); $parentDn = $this->_getDn()->getParentDn(1); - return self::fromLDAP($parentDn, $ldap); + return self::fromLdap($parentDn, $ldap); } /** diff --git a/library/Zend/LDAP/Node/AbstractNode.php b/library/Zend/Ldap/Node/AbstractNode.php similarity index 91% rename from library/Zend/LDAP/Node/AbstractNode.php rename to library/Zend/Ldap/Node/AbstractNode.php index 4482bab16db..e8a96f9c51c 100644 --- a/library/Zend/LDAP/Node/AbstractNode.php +++ b/library/Zend/Ldap/Node/AbstractNode.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,19 +23,19 @@ /** * @namespace */ -namespace Zend\LDAP\Node; -use Zend\LDAP; +namespace Zend\Ldap\Node; +use Zend\Ldap; /** - * Zend_LDAP_Node_Abstract provides a bas eimplementation for LDAP nodes + * Zend_Ldap_Node_Abstract provides a bas eimplementation for LDAP nodes * * @uses ArrayAccess * @uses BadMethodCallException * @uses Countable - * @uses \Zend\LDAP\Attribute - * @uses \Zend\LDAP\DN + * @uses \Zend\Ldap\Attribute + * @uses \Zend\Ldap\Dn * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -51,7 +51,7 @@ abstract class AbstractNode implements \ArrayAccess, \Countable /** * Holds the node's DN. * - * @var \Zend\LDAP\DN + * @var \Zend\Ldap\Dn */ protected $_dn; @@ -67,11 +67,11 @@ abstract class AbstractNode implements \ArrayAccess, \Countable * * Constructor is protected to enforce the use of factory methods. * - * @param \Zend\LDAP\DN $dn + * @param \Zend\Ldap\Dn $dn * @param array $data * @param boolean $fromDataSource */ - protected function __construct(LDAP\DN $dn, array $data, $fromDataSource) + protected function __construct(Ldap\Dn $dn, array $data, $fromDataSource) { $this->_dn = $dn; $this->_loadData($data, $fromDataSource); @@ -80,7 +80,7 @@ protected function __construct(LDAP\DN $dn, array $data, $fromDataSource) /** * @param array $data * @param boolean $fromDataSource - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ protected function _loadData(array $data, $fromDataSource) { @@ -96,11 +96,11 @@ protected function _loadData(array $data, $fromDataSource) * * This is an online method. * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\AbstractNode Provides a fluid interface - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\AbstractNode Provides a fluid interface + * @throws \Zend\Ldap\Exception */ - public function reload(LDAP\LDAP $ldap = null) + public function reload(Ldap\Ldap $ldap = null) { if ($ldap !== null) { $data = $ldap->getEntry($this->_getDn(), array('*', '+'), true); @@ -110,11 +110,11 @@ public function reload(LDAP\LDAP $ldap = null) } /** - * Gets the DN of the current node as a Zend_LDAP_Dn. + * Gets the DN of the current node as a Zend_Ldap_Dn. * * This is an offline method. * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ protected function _getDn() { @@ -122,12 +122,12 @@ protected function _getDn() } /** - * Gets the DN of the current node as a Zend_LDAP_Dn. + * Gets the DN of the current node as a Zend_Ldap_Dn. * The method returns a clone of the node's DN to prohibit modification. * * This is an offline method. * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ public function getDn() { @@ -316,7 +316,7 @@ public function existsAttribute($name, $emptyExists = false) */ public function attributeHasValue($attribName, $value) { - return LDAP\Attribute::attributeHasValue($this->_currentData, $attribName, $value); + return Ldap\Attribute::attributeHasValue($this->_currentData, $attribName, $value); } /** @@ -327,7 +327,7 @@ public function attributeHasValue($attribName, $value) * @param string $name * @param integer $index * @return mixed - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function getAttribute($name, $index = null) { @@ -335,7 +335,7 @@ public function getAttribute($name, $index = null) return $this->getDnString(); } else { - return LDAP\Attribute::getAttribute($this->_currentData, $name, $index); + return Ldap\Attribute::getAttribute($this->_currentData, $name, $index); } } @@ -347,11 +347,11 @@ public function getAttribute($name, $index = null) * @param string $name * @param integer $index * @return array|integer - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function getDateTimeAttribute($name, $index = null) { - return LDAP\Attribute::getDateTimeAttribute($this->_currentData, $name, $index); + return Ldap\Attribute::getDateTimeAttribute($this->_currentData, $name, $index); } /** @@ -376,7 +376,7 @@ public function __set($name, $value) * * @param string $name * @return array - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function __get($name) { @@ -436,7 +436,7 @@ public function offsetSet($name, $value) * * @param string $name * @return array - * @throws \Zend\LDAP\Exception + * @throws \Zend\Ldap\Exception */ public function offsetGet($name) { diff --git a/library/Zend/LDAP/Node/ChildrenIterator.php b/library/Zend/Ldap/Node/ChildrenIterator.php similarity index 92% rename from library/Zend/LDAP/Node/ChildrenIterator.php rename to library/Zend/Ldap/Node/ChildrenIterator.php index fde903a2cd5..3908e36ca7b 100644 --- a/library/Zend/LDAP/Node/ChildrenIterator.php +++ b/library/Zend/Ldap/Node/ChildrenIterator.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,20 +23,20 @@ /** * @namespace */ -namespace Zend\LDAP\Node; +namespace Zend\Ldap\Node; -use Zend\LDAP\Node; +use Zend\Ldap\Node; /** - * Zend_LDAP_Node_ChildrenIterator provides an iterator to a collection of children nodes. + * Zend_Ldap_Node_ChildrenIterator provides an iterator to a collection of children nodes. * * @uses ArrayAccess * @uses Countable * @uses Iterator * @uses RecursiveIterator - * @uses \Zend\LDAP\Node + * @uses \Zend\Ldap\Node * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -44,7 +44,7 @@ class ChildrenIterator implements \Iterator, \Countable, \RecursiveIterator, \ArrayAccess { /** - * An array of Zend_LDAP_Node objects + * An array of Zend_Ldap_Node objects * * @var array */ @@ -76,7 +76,7 @@ public function count() * Return the current child. * Implements Iterator * - * @return \Zend\LDAP\Node + * @return \Zend\Ldap\Node */ public function current() { @@ -142,7 +142,7 @@ public function hasChildren() /** * Returns the children for the current node. * - * @return \Zend\LDAP\Node\ChildrenIterator + * @return \Zend\Ldap\Node\ChildrenIterator */ public function getChildren() { @@ -158,7 +158,7 @@ public function getChildren() * Implements ArrayAccess. * * @param string $rdn - * @return Zend_LDAP_node + * @return Zend_Ldap_node */ public function offsetGet($rdn) { diff --git a/library/Zend/LDAP/Node/Collection.php b/library/Zend/Ldap/Node/Collection.php similarity index 82% rename from library/Zend/LDAP/Node/Collection.php rename to library/Zend/Ldap/Node/Collection.php index cde853be321..09331359e32 100644 --- a/library/Zend/LDAP/Node/Collection.php +++ b/library/Zend/Ldap/Node/Collection.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,28 +23,28 @@ /** * @namespace */ -namespace Zend\LDAP\Node; +namespace Zend\Ldap\Node; -use Zend\LDAP\Node; +use Zend\Ldap\Node; /** - * Zend_LDAP_Node_Collection provides a collecion of nodes. + * Zend_Ldap_Node_Collection provides a collecion of nodes. * - * @uses \Zend\LDAP\Collection - * @uses \Zend\LDAP\Node + * @uses \Zend\Ldap\Collection + * @uses \Zend\Ldap\Node * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Node * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Collection extends \Zend\LDAP\Collection +class Collection extends \Zend\Ldap\Collection { /** * Creates the data structure for the given entry data * * @param array $data - * @return \Zend\LDAP\Node + * @return \Zend\Ldap\Node */ protected function _createEntry(array $data) { diff --git a/library/Zend/LDAP/Node/RootDSE.php b/library/Zend/Ldap/Node/RootDse.php similarity index 75% rename from library/Zend/LDAP/Node/RootDSE.php rename to library/Zend/Ldap/Node/RootDse.php index 842f1dfa6c2..b35afdeda86 100644 --- a/library/Zend/LDAP/Node/RootDSE.php +++ b/library/Zend/Ldap/Node/RootDse.php @@ -13,8 +13,8 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -23,24 +23,24 @@ /** * @namespace */ -namespace Zend\LDAP\Node; -use Zend\LDAP; +namespace Zend\Ldap\Node; +use Zend\Ldap; /** - * Zend_LDAP_Node_RootDse provides a simple data-container for the RootDSE node. + * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node. * - * @uses \Zend\LDAP\DN - * @uses \Zend\LDAP\Node\AbstractNode - * @uses \Zend\LDAP\Node\RootDSE\ActiveDirectory - * @uses \Zend\LDAP\Node\RootDSE\eDirectory - * @uses \Zend\LDAP\Node\RootDSE\OpenLDAP + * @uses \Zend\Ldap\Dn + * @uses \Zend\Ldap\Node\AbstractNode + * @uses \Zend\Ldap\Node\RootDse\ActiveDirectory + * @uses \Zend\Ldap\Node\RootDse\eDirectory + * @uses \Zend\Ldap\Node\RootDse\OpenLdap * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RootDSE extends AbstractNode +class RootDse extends AbstractNode { const SERVER_TYPE_GENERIC = 1; const SERVER_TYPE_OPENLDAP = 2; @@ -50,21 +50,21 @@ class RootDSE extends AbstractNode /** * Factory method to create the RootDSE. * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\RootDSE - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\RootDse + * @throws \Zend\Ldap\Exception */ - public static function create(LDAP\LDAP $ldap) + public static function create(Ldap\Ldap $ldap) { - $dn = LDAP\DN::fromString(''); + $dn = Ldap\Dn::fromString(''); $data = $ldap->getEntry($dn, array('*', '+'), true); if (isset($data['domainfunctionality'])) { - return new RootDSE\ActiveDirectory($dn, $data); + return new RootDse\ActiveDirectory($dn, $data); } else if (isset($data['dsaname'])) { - return new RootDSE\eDirectory($dn, $data); + return new RootDse\eDirectory($dn, $data); } else if (isset($data['structuralobjectclass']) && $data['structuralobjectclass'][0] === 'OpenLDAProotDSE') { - return new RootDSE\OpenLDAP($dn, $data); + return new RootDse\OpenLdap($dn, $data); } else { return new self($dn, $data); } @@ -75,10 +75,10 @@ public static function create(LDAP\LDAP $ldap) * * Constructor is protected to enforce the use of factory methods. * - * @param \Zend\LDAP\DN $dn + * @param \Zend\Ldap\Dn $dn * @param array $data */ - protected function __construct(LDAP\DN $dn, array $data) + protected function __construct(Ldap\Dn $dn, array $data) { parent::__construct($dn, $data, true); } @@ -138,11 +138,11 @@ public function getServerType() /** * Returns the schema DN * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ public function getSchemaDn() { $schemaDn = $this->getSubschemaSubentry(); - return LDAP\DN::fromString($schemaDn); + return Ldap\Dn::fromString($schemaDn); } } diff --git a/library/Zend/LDAP/Node/RootDSE/ActiveDirectory.php b/library/Zend/Ldap/Node/RootDse/ActiveDirectory.php similarity index 92% rename from library/Zend/LDAP/Node/RootDSE/ActiveDirectory.php rename to library/Zend/Ldap/Node/RootDse/ActiveDirectory.php index 0862aa5414b..3566d9d5117 100644 --- a/library/Zend/LDAP/Node/RootDSE/ActiveDirectory.php +++ b/library/Zend/Ldap/Node/RootDse/ActiveDirectory.php @@ -13,8 +13,8 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -23,23 +23,23 @@ /** * @namespace */ -namespace Zend\LDAP\Node\RootDSE; +namespace Zend\Ldap\Node\RootDse; -use Zend\LDAP\Node\RootDSE; +use Zend\Ldap\Node\RootDse; /** - * Zend_LDAP_Node_RootDse provides a simple data-container for the RootDSE node of + * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node of * an Active Directory server. * - * @uses \Zend\LDAP\DN - * @uses \Zend\LDAP\Node\RootDSE + * @uses \Zend\Ldap\Dn + * @uses \Zend\Ldap\Node\RootDse * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class ActiveDirectory extends RootDSE +class ActiveDirectory extends RootDse { /** * Gets the configurationNamingContext. @@ -237,11 +237,11 @@ public function getServerType() /** * Returns the schema DN * - * @return \Zend\LDAP\DN + * @return \Zend\Ldap\Dn */ public function getSchemaDn() { $schemaDn = $this->getSchemaNamingContext(); - return \Zend\LDAP\DN::fromString($schemaDn); + return \Zend\Ldap\Dn::fromString($schemaDn); } } diff --git a/library/Zend/LDAP/Node/RootDSE/OpenLDAP.php b/library/Zend/Ldap/Node/RootDse/OpenLdap.php similarity index 88% rename from library/Zend/LDAP/Node/RootDSE/OpenLDAP.php rename to library/Zend/Ldap/Node/RootDse/OpenLdap.php index 0109baeb4d6..b673f07bbb8 100644 --- a/library/Zend/LDAP/Node/RootDSE/OpenLDAP.php +++ b/library/Zend/Ldap/Node/RootDse/OpenLdap.php @@ -13,8 +13,8 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -23,22 +23,22 @@ /** * @namespace */ -namespace Zend\LDAP\Node\RootDSE; +namespace Zend\Ldap\Node\RootDse; -use Zend\LDAP\Node\RootDSE; +use Zend\Ldap\Node\RootDse; /** - * Zend_LDAP_Node_RootDse provides a simple data-container for the RootDSE node of + * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node of * an OpenLDAP server. * - * @uses \Zend\LDAP\Node\RootDSE + * @uses \Zend\Ldap\Node\RootDse * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class OpenLDAP extends RootDSE +class OpenLdap extends RootDse { /** * Gets the configContext. diff --git a/library/Zend/LDAP/Node/RootDSE/eDirectory.php b/library/Zend/Ldap/Node/RootDse/eDirectory.php similarity index 92% rename from library/Zend/LDAP/Node/RootDSE/eDirectory.php rename to library/Zend/Ldap/Node/RootDse/eDirectory.php index f46d7fe4ece..070e3e01a6d 100644 --- a/library/Zend/LDAP/Node/RootDSE/eDirectory.php +++ b/library/Zend/Ldap/Node/RootDse/eDirectory.php @@ -13,8 +13,8 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ @@ -23,22 +23,22 @@ /** * @namespace */ -namespace Zend\LDAP\Node\RootDSE; +namespace Zend\Ldap\Node\RootDse; -use Zend\LDAP\Node\RootDSE; +use Zend\Ldap\Node\RootDse; /** - * Zend_LDAP_Node_RootDse provides a simple data-container for the RootDSE node of + * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node of * a Novell eDirectory server. * - * @uses \Zend\LDAP\Node\RootDSE + * @uses \Zend\Ldap\Node\RootDse * @category Zend - * @package Zend_LDAP - * @subpackage RootDSE + * @package Zend_Ldap + * @subpackage RootDse * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class eDirectory extends RootDSE +class eDirectory extends RootDse { /** * Determines if the extension is supported diff --git a/library/Zend/LDAP/Node/Schema.php b/library/Zend/Ldap/Node/Schema.php similarity index 71% rename from library/Zend/LDAP/Node/Schema.php rename to library/Zend/Ldap/Node/Schema.php index e15d6f3e135..bbd354b7afa 100644 --- a/library/Zend/LDAP/Node/Schema.php +++ b/library/Zend/Ldap/Node/Schema.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,20 +23,20 @@ /** * @namespace */ -namespace Zend\LDAP\Node; +namespace Zend\Ldap\Node; -use Zend\LDAP; -use Zend\LDAP\Node\RootDSE; +use Zend\Ldap; +use Zend\Ldap\Node\RootDSE; /** - * Zend_LDAP_Node_Schema provides a simple data-container for the Schema node. + * Zend_Ldap_Node_Schema provides a simple data-container for the Schema node. * - * @uses \Zend\LDAP\Node\AbstractNode - * @uses \Zend\LDAP\Node\RootDSE\RootDSE - * @uses \Zend\LDAP\Node\RootDSE\ActiveDirectory - * @uses \Zend\LDAP\Node\Schema\ActiveDirectory + * @uses \Zend\Ldap\Node\AbstractNode + * @uses \Zend\Ldap\Node\RootDSE\RootDSE + * @uses \Zend\Ldap\Node\RootDSE\ActiveDirectory + * @uses \Zend\Ldap\Node\Schema\ActiveDirectory * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -51,11 +51,11 @@ class Schema extends AbstractNode /** * Factory method to create the Schema node. * - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\Schema - * @throws \Zend\LDAP\Exception + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\Schema + * @throws \Zend\Ldap\Exception */ - public static function create(LDAP\LDAP $ldap) + public static function create(Ldap\Ldap $ldap) { $dn = $ldap->getRootDse()->getSchemaDn(); $data = $ldap->getEntry($dn, array('*', '+'), true); @@ -63,7 +63,7 @@ public static function create(LDAP\LDAP $ldap) case RootDSE::SERVER_TYPE_ACTIVEDIRECTORY: return new Schema\ActiveDirectory($dn, $data, $ldap); case RootDSE::SERVER_TYPE_OPENLDAP: - return new Schema\OpenLDAP($dn, $data, $ldap); + return new Schema\OpenLdap($dn, $data, $ldap); case RootDSE::SERVER_TYPE_EDIRECTORY: default: return new self($dn, $data, $ldap); @@ -75,11 +75,11 @@ public static function create(LDAP\LDAP $ldap) * * Constructor is protected to enforce the use of factory methods. * - * @param \Zend\LDAP\DN $dn + * @param \Zend\Ldap\Dn $dn * @param array $data - * @param \Zend\LDAP\LDAP $ldap + * @param \Zend\Ldap\Ldap $ldap */ - protected function __construct(LDAP\DN $dn, array $data, LDAP\LDAP $ldap) + protected function __construct(Ldap\Dn $dn, array $data, Ldap\Ldap $ldap) { parent::__construct($dn, $data, true); $this->_parseSchema($dn, $ldap); @@ -88,11 +88,11 @@ protected function __construct(LDAP\DN $dn, array $data, LDAP\LDAP $ldap) /** * Parses the schema * - * @param \Zend\LDAP\DN $dn - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\Schema Provides a fluid interface + * @param \Zend\Ldap\Dn $dn + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\Schema Provides a fluid interface */ - protected function _parseSchema(LDAP\DN $dn, LDAP\LDAP $ldap) + protected function _parseSchema(Ldap\Dn $dn, Ldap\Ldap $ldap) { return $this; } diff --git a/library/Zend/LDAP/Node/Schema/ActiveDirectory.php b/library/Zend/Ldap/Node/Schema/ActiveDirectory.php similarity index 75% rename from library/Zend/LDAP/Node/Schema/ActiveDirectory.php rename to library/Zend/Ldap/Node/Schema/ActiveDirectory.php index 0731cb6defd..79e74213fa1 100644 --- a/library/Zend/LDAP/Node/Schema/ActiveDirectory.php +++ b/library/Zend/Ldap/Node/Schema/ActiveDirectory.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,21 +23,21 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema; +namespace Zend\Ldap\Node\Schema; -use Zend\LDAP\Node\Schema, - Zend\LDAP; +use Zend\Ldap\Node\Schema, + Zend\Ldap; /** - * Zend_LDAP_Node_Schema_ActiveDirectory provides a simple data-container for the Schema node of + * Zend_Ldap_Node_Schema_ActiveDirectory provides a simple data-container for the Schema node of * an Active Directory server. * - * @uses \Zend\LDAP\LDAP - * @uses \Zend\LDAP\Node\Schema - * @uses \Zend\LDAP\Node\Schema\AttributeType\ActiveDirectory - * @uses \Zend\LDAP\Node\Schema\ObjectClass\ActiveDirectory + * @uses \Zend\Ldap\Ldap + * @uses \Zend\Ldap\Node\Schema + * @uses \Zend\Ldap\Node\Schema\AttributeType\ActiveDirectory + * @uses \Zend\Ldap\Node\Schema\ObjectClass\ActiveDirectory * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -60,20 +60,20 @@ class ActiveDirectory extends Schema /** * Parses the schema * - * @param \Zend\LDAP\DN $dn - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\Schema Provides a fluid interface + * @param \Zend\Ldap\Dn $dn + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\Schema Provides a fluid interface */ - protected function _parseSchema(LDAP\DN $dn, LDAP\LDAP $ldap) + protected function _parseSchema(Ldap\Dn $dn, Ldap\Ldap $ldap) { parent::_parseSchema($dn, $ldap); foreach ($ldap->search('(objectClass=classSchema)', $dn, - LDAP\LDAP::SEARCH_SCOPE_ONE) as $node) { + Ldap\Ldap::SEARCH_SCOPE_ONE) as $node) { $val = new ObjectClass\ActiveDirectory($node); $this->_objectClasses[$val->getName()] = $val; } foreach ($ldap->search('(objectClass=attributeSchema)', $dn, - LDAP\LDAP::SEARCH_SCOPE_ONE) as $node) { + Ldap\Ldap::SEARCH_SCOPE_ONE) as $node) { $val = new AttributeType\ActiveDirectory($node); $this->_attributeTypes[$val->getName()] = $val; } diff --git a/library/Zend/LDAP/Node/Schema/AttributeType.php b/library/Zend/Ldap/Node/Schema/AttributeType.php similarity index 92% rename from library/Zend/LDAP/Node/Schema/AttributeType.php rename to library/Zend/Ldap/Node/Schema/AttributeType.php index 30d3a03d1a8..be4ed8a36aa 100644 --- a/library/Zend/LDAP/Node/Schema/AttributeType.php +++ b/library/Zend/Ldap/Node/Schema/AttributeType.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,13 +23,13 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema; +namespace Zend\Ldap\Node\Schema; /** - * Zend\LDAP\Node\Schema\AttributeType provides a contract for schema attribute-types. + * Zend\Ldap\Node\Schema\AttributeType provides a contract for schema attribute-types. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Node/Schema/AttributeType/ActiveDirectory.php b/library/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php similarity index 85% rename from library/Zend/LDAP/Node/Schema/AttributeType/ActiveDirectory.php rename to library/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php index 2438e820371..27e89d62002 100644 --- a/library/Zend/LDAP/Node/Schema/AttributeType/ActiveDirectory.php +++ b/library/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,19 +23,19 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema\AttributeType; +namespace Zend\Ldap\Node\Schema\AttributeType; -use Zend\LDAP\Node\Schema\AttributeType, - Zend\LDAP\Node\Schema; +use Zend\Ldap\Node\Schema\AttributeType, + Zend\Ldap\Node\Schema; /** - * Zend_LDAP_Node_Schema_AttributeType_ActiveDirectory provides access to the attribute type + * Zend_Ldap_Node_Schema_AttributeType_ActiveDirectory provides access to the attribute type * schema information on an Active Directory server. * - * @uses \Zend\LDAP\Node\Schema\AttributeType - * @uses \Zend\LDAP\Node\Schema\Item + * @uses \Zend\Ldap\Node\Schema\AttributeType + * @uses \Zend\Ldap\Node\Schema\Item * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Node/Schema/AttributeType/OpenLDAP.php b/library/Zend/Ldap/Node/Schema/AttributeType/OpenLdap.php similarity index 85% rename from library/Zend/LDAP/Node/Schema/AttributeType/OpenLDAP.php rename to library/Zend/Ldap/Node/Schema/AttributeType/OpenLdap.php index 6df2691eb97..e3338d87786 100644 --- a/library/Zend/LDAP/Node/Schema/AttributeType/OpenLDAP.php +++ b/library/Zend/Ldap/Node/Schema/AttributeType/OpenLdap.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,24 +23,24 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema\AttributeType; +namespace Zend\Ldap\Node\Schema\AttributeType; -use Zend\LDAP\Node\Schema\AttributeType, - Zend\LDAP\Node\Schema; +use Zend\Ldap\Node\Schema\AttributeType, + Zend\Ldap\Node\Schema; /** - * Zend_LDAP_Node_Schema_AttributeType_OpenLDAP provides access to the attribute type + * Zend_Ldap_Node_Schema_AttributeType_OpenLdap provides access to the attribute type * schema information on an OpenLDAP server. * - * @uses \Zend\LDAP\Node\Schema\AttributeType - * @uses \Zend\LDAP\Node\Schema\Item + * @uses \Zend\Ldap\Node\Schema\AttributeType + * @uses \Zend\Ldap\Node\Schema\Item * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class OpenLDAP extends Schema\Item implements AttributeType +class OpenLdap extends Schema\Item implements AttributeType { /** * Gets the attribute name @@ -118,7 +118,7 @@ public function getDescription() /** * Returns the parent attribute type in the inhertitance tree if one exists * - * @return \Zend\LDAP\Node\Schema\AttributeType\OpenLDAP|null + * @return \Zend\Ldap\Node\Schema\AttributeType\OpenLdap|null */ public function getParent() { diff --git a/library/Zend/LDAP/Node/Schema/Item.php b/library/Zend/Ldap/Node/Schema/Item.php similarity index 94% rename from library/Zend/LDAP/Node/Schema/Item.php rename to library/Zend/Ldap/Node/Schema/Item.php index 4ff6fab4064..3bf2cf4bf7f 100644 --- a/library/Zend/LDAP/Node/Schema/Item.php +++ b/library/Zend/Ldap/Node/Schema/Item.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,17 +23,17 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema; +namespace Zend\Ldap\Node\Schema; /** - * Zend_LDAP_Node_Schema_Item provides a base implementation for managing schema + * Zend_Ldap_Node_Schema_Item provides a base implementation for managing schema * items like objectClass and attribute. * * @uses ArrayAccess * @uses BadMethodCallException * @uses Countable * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -61,7 +61,7 @@ public function __construct(array $data) * Sets the data * * @param array $data - * @return \Zend\LDAP\Node\Schema\Item Provides a fluid interface + * @return \Zend\Ldap\Node\Schema\Item Provides a fluid interface */ public function setData(array $data) { diff --git a/library/Zend/LDAP/Node/Schema/ObjectClass.php b/library/Zend/Ldap/Node/Schema/ObjectClass.php similarity index 92% rename from library/Zend/LDAP/Node/Schema/ObjectClass.php rename to library/Zend/Ldap/Node/Schema/ObjectClass.php index ed5d34db487..f9aaee83a3b 100644 --- a/library/Zend/LDAP/Node/Schema/ObjectClass.php +++ b/library/Zend/Ldap/Node/Schema/ObjectClass.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,13 +23,13 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema; +namespace Zend\Ldap\Node\Schema; /** - * Zend\LDAP\Node\Schema\ObjectClass provides a contract for schema objectClasses. + * Zend\Ldap\Node\Schema\ObjectClass provides a contract for schema objectClasses. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Node/Schema/ObjectClass/ActiveDirectory.php b/library/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php similarity index 87% rename from library/Zend/LDAP/Node/Schema/ObjectClass/ActiveDirectory.php rename to library/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php index dd17c49bc96..5e971347e53 100644 --- a/library/Zend/LDAP/Node/Schema/ObjectClass/ActiveDirectory.php +++ b/library/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,19 +23,19 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema\ObjectClass; +namespace Zend\Ldap\Node\Schema\ObjectClass; -use Zend\LDAP\Node\Schema\ObjectClass, - Zend\LDAP\Node\Schema; +use Zend\Ldap\Node\Schema\ObjectClass, + Zend\Ldap\Node\Schema; /** - * Zend_LDAP_Node_Schema_ObjectClass_ActiveDirectory provides access to the objectClass + * Zend_Ldap_Node_Schema_ObjectClass_ActiveDirectory provides access to the objectClass * schema information on an Active Directory server. * - * @uses \Zend\LDAP\Node\Schema\Item - * @uses \Zend\LDAP\Node\Schema\ObjectClass + * @uses \Zend\Ldap\Node\Schema\Item + * @uses \Zend\Ldap\Node\Schema\ObjectClass * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/LDAP/Node/Schema/ObjectClass/OpenLDAP.php b/library/Zend/Ldap/Node/Schema/ObjectClass/OpenLdap.php similarity index 88% rename from library/Zend/LDAP/Node/Schema/ObjectClass/OpenLDAP.php rename to library/Zend/Ldap/Node/Schema/ObjectClass/OpenLdap.php index 1ba578c1bc3..2e5ceb81f6e 100644 --- a/library/Zend/LDAP/Node/Schema/ObjectClass/OpenLDAP.php +++ b/library/Zend/Ldap/Node/Schema/ObjectClass/OpenLdap.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,25 +23,25 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema\ObjectClass; +namespace Zend\Ldap\Node\Schema\ObjectClass; -use Zend\LDAP\Node\Schema\ObjectClass, - Zend\LDAP\Node\Schema; +use Zend\Ldap\Node\Schema\ObjectClass, + Zend\Ldap\Node\Schema; /** - * Zend\LDAP\Node\Schema\ObjectClass\OpenLDAP provides access to the objectClass + * Zend\Ldap\Node\Schema\ObjectClass\OpenLdap provides access to the objectClass * schema information on an OpenLDAP server. * - * @uses \Zend\LDAP\Node\Schema - * @uses \Zend\LDAP\Node\Schema\Item - * @uses \Zend\LDAP\Node\Schema\ObjectClass + * @uses \Zend\Ldap\Node\Schema + * @uses \Zend\Ldap\Node\Schema\Item + * @uses \Zend\Ldap\Node\Schema\ObjectClass * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class OpenLDAP extends Schema\Item implements ObjectClass +class OpenLdap extends Schema\Item implements ObjectClass { /** * All inherited "MUST" attributes @@ -167,7 +167,7 @@ public function getParentClasses() /** * Returns the parent object classes in the inhertitance tree if one exists * - * @return array of \Zend\LDAP\Node\Schema\ObjectClass\OpenLDAP + * @return array of \Zend\Ldap\Node\Schema\ObjectClass\OpenLdap */ public function getParents() { diff --git a/library/Zend/LDAP/Node/Schema/OpenLDAP.php b/library/Zend/Ldap/Node/Schema/OpenLdap.php similarity index 89% rename from library/Zend/LDAP/Node/Schema/OpenLDAP.php rename to library/Zend/Ldap/Node/Schema/OpenLdap.php index 43e4196f498..371773c94ff 100644 --- a/library/Zend/LDAP/Node/Schema/OpenLDAP.php +++ b/library/Zend/Ldap/Node/Schema/OpenLdap.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -23,26 +23,26 @@ /** * @namespace */ -namespace Zend\LDAP\Node\Schema; +namespace Zend\Ldap\Node\Schema; -use Zend\LDAP\Node\Schema, - Zend\LDAP; +use Zend\Ldap\Node\Schema, + Zend\Ldap; /** - * Zend_LDAP_Node_Schema_OpenLDAP provides a simple data-container for the Schema node of + * Zend_Ldap_Node_Schema_OpenLDAP provides a simple data-container for the Schema node of * an OpenLDAP server. * - * @uses \Zend\LDAP\Attribute - * @uses \Zend\LDAP\Node\Schema - * @uses \Zend\LDAP\Node\Schema\AttributeType\OpenLDAP - * @uses \Zend\LDAP\Node\Schema\ObjectClass\OpenLDAP + * @uses \Zend\Ldap\Attribute + * @uses \Zend\Ldap\Node\Schema + * @uses \Zend\Ldap\Node\Schema\AttributeType\OpenLdap + * @uses \Zend\Ldap\Node\Schema\ObjectClass\OpenLdap * @category Zend - * @package Zend_LDAP + * @package Zend_Ldap * @subpackage Schema * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class OpenLDAP extends Schema +class OpenLdap extends Schema { /** * The attribute Types @@ -78,15 +78,15 @@ class OpenLDAP extends Schema /** * Parses the schema * - * @param \Zend\LDAP\DN $dn - * @param \Zend\LDAP\LDAP $ldap - * @return \Zend\LDAP\Node\Schema Provides a fluid interface + * @param \Zend\Ldap\Dn $dn + * @param \Zend\Ldap\Ldap $ldap + * @return \Zend\Ldap\Node\Schema Provides a fluid interface */ - protected function _parseSchema(LDAP\DN $dn, LDAP\LDAP $ldap) + protected function _parseSchema(Ldap\Dn $dn, Ldap\Ldap $ldap) { parent::_parseSchema($dn, $ldap); $this->_loadAttributeTypes(); - $this->_loadLDAPSyntaxes(); + $this->_loadLdapSyntaxes(); $this->_loadMatchingRules(); $this->_loadMatchingRuleUse(); $this->_loadObjectClasses(); @@ -118,7 +118,7 @@ public function getObjectClasses() * * @return array */ - public function getLDAPSyntaxes() + public function getLdapSyntaxes() { return $this->_ldapSyntaxes; } @@ -153,7 +153,7 @@ protected function _loadAttributeTypes() $this->_attributeTypes = array(); foreach ($this->getAttribute('attributeTypes') as $value) { $val = $this->_parseAttributeType($value); - $val = new AttributeType\OpenLDAP($val); + $val = new AttributeType\OpenLdap($val); $this->_attributeTypes[$val->getName()] = $val; } @@ -196,7 +196,7 @@ protected function _parseAttributeType($value) $tokens = $this->_tokenizeString($value); $attributeType['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLDAPSchemaSyntax($attributeType, $tokens); + $this->_parseLdapSchemaSyntax($attributeType, $tokens); if (array_key_exists('syntax', $attributeType)) { // get max length from syntax @@ -221,7 +221,7 @@ protected function _loadObjectClasses() $this->_objectClasses = array(); foreach ($this->getAttribute('objectClasses') as $value) { $val = $this->_parseObjectClass($value); - $val = new ObjectClass\OpenLDAP($val); + $val = new ObjectClass\OpenLdap($val); $this->_objectClasses[$val->getName()] = $val; } foreach ($this->_objectClasses as $val) { @@ -259,7 +259,7 @@ protected function _parseObjectClass($value) $tokens = $this->_tokenizeString($value); $objectClass['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLDAPSchemaSyntax($objectClass, $tokens); + $this->_parseLdapSchemaSyntax($objectClass, $tokens); $this->_ensureNameAttribute($objectClass); @@ -269,7 +269,7 @@ protected function _parseObjectClass($value) /** * Resolves inheritance in objectClasses and attributes * - * @param \Zend\LDAP\Node\Schema\Item $node + * @param \Zend\Ldap\Node\Schema\Item $node * @param array $repository */ protected function _resolveInheritance(Item $node, array $repository) @@ -292,11 +292,11 @@ protected function _resolveInheritance(Item $node, array $repository) * * @return void */ - protected function _loadLDAPSyntaxes() + protected function _loadLdapSyntaxes() { $this->_ldapSyntaxes = array(); foreach ($this->getAttribute('ldapSyntaxes') as $value) { - $val = $this->_parseLDAPSyntax($value); + $val = $this->_parseLdapSyntax($value); $this->_ldapSyntaxes[$val['oid']] = $val; } ksort($this->_ldapSyntaxes, SORT_STRING); @@ -308,7 +308,7 @@ protected function _loadLDAPSyntaxes() * @param string $value * @return array */ - protected function _parseLDAPSyntax($value) + protected function _parseLdapSyntax($value) { $ldapSyntax = array( 'oid' => null, @@ -317,7 +317,7 @@ protected function _parseLDAPSyntax($value) $tokens = $this->_tokenizeString($value); $ldapSyntax['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLDAPSchemaSyntax($ldapSyntax, $tokens); + $this->_parseLdapSchemaSyntax($ldapSyntax, $tokens); return $ldapSyntax; } @@ -355,7 +355,7 @@ protected function _parseMatchingRule($value) $tokens = $this->_tokenizeString($value); $matchingRule['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLDAPSchemaSyntax($matchingRule, $tokens); + $this->_parseLdapSchemaSyntax($matchingRule, $tokens); $this->_ensureNameAttribute($matchingRule); @@ -395,7 +395,7 @@ protected function _parseMatchingRuleUse($value) $tokens = $this->_tokenizeString($value); $matchingRuleUse['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLDAPSchemaSyntax($matchingRuleUse, $tokens); + $this->_parseLdapSchemaSyntax($matchingRuleUse, $tokens); $this->_ensureNameAttribute($matchingRuleUse); @@ -430,7 +430,7 @@ protected function _ensureNameAttribute(array &$data) * @param array $tokens * @return void */ - protected function _parseLDAPSchemaSyntax(array &$data, array $tokens) + protected function _parseLdapSchemaSyntax(array &$data, array $tokens) { // tokens that have no value associated $noValue = array('single-value', @@ -457,11 +457,11 @@ protected function _parseLDAPSchemaSyntax(array &$data, array $tokens) while ($tmp = array_shift($tokens)) { if ($tmp == ')') break; if ($tmp != '$') { - $data[$token][] = LDAP\Attribute::convertFromLDAPValue($tmp); + $data[$token][] = Ldap\Attribute::convertFromLdapValue($tmp); } } } else { - $data[$token] = LDAP\Attribute::convertFromLDAPValue($data[$token]); + $data[$token] = Ldap\Attribute::convertFromLdapValue($data[$token]); } // create a array if the value should be multivalued but was not if (in_array($token, $multiValue) && !is_array($data[$token])) { diff --git a/tests/Zend/LDAP/AttributeTest.php b/tests/Zend/Ldap/AttributeTest.php similarity index 75% rename from tests/Zend/LDAP/AttributeTest.php rename to tests/Zend/Ldap/AttributeTest.php index 40c2e8b6601..8478dc0ce21 100644 --- a/tests/Zend/LDAP/AttributeTest.php +++ b/tests/Zend/Ldap/AttributeTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** * @category Zend @@ -51,23 +51,23 @@ protected function _assertUtcDateTimeString($localTimestamp, $value) public function testGetAttributeValue() { $data=array('uid' => array('value')); - $value=LDAP\Attribute::getAttribute($data, 'uid', 0); + $value=Ldap\Attribute::getAttribute($data, 'uid', 0); $this->assertEquals('value', $value); } public function testGetNonExistentAttributeValue() { $data=array('uid' => array('value')); - $value=LDAP\Attribute::getAttribute($data, 'uid', 1); + $value=Ldap\Attribute::getAttribute($data, 'uid', 1); $this->assertNull($value); } public function testGetNonExistentAttribute() { $data=array('uid' => array('value')); - $value=LDAP\Attribute::getAttribute($data, 'uid2', 0); + $value=Ldap\Attribute::getAttribute($data, 'uid2', 0); $this->assertNull($value); - $array=LDAP\Attribute::getAttribute($data, 'uid2'); + $array=Ldap\Attribute::getAttribute($data, 'uid2'); $this->assertType('array', $array); $this->assertEquals(0, count($array)); } @@ -75,16 +75,16 @@ public function testGetNonExistentAttribute() public function testGetAttributeWithWrongIndexType() { $data=array('uid' => array('value')); - $value=LDAP\Attribute::getAttribute($data, 'uid', 'index'); + $value=Ldap\Attribute::getAttribute($data, 'uid', 'index'); $this->assertNull($value); - $value=LDAP\Attribute::getAttribute($data, 'uid', 3.1415); + $value=Ldap\Attribute::getAttribute($data, 'uid', 3.1415); $this->assertNull($value); } public function testGetAttributeArray() { $data=array('uid' => array('value')); - $value=LDAP\Attribute::getAttribute($data, 'uid'); + $value=Ldap\Attribute::getAttribute($data, 'uid'); $this->assertType('array', $value); $this->assertEquals(1, count($value)); $this->assertContains('value', $value); @@ -93,7 +93,7 @@ public function testGetAttributeArray() public function testSimpleSetAttribute() { $data=array(); - LDAP\Attribute::setAttribute($data, 'uid', 'new', false); + Ldap\Attribute::setAttribute($data, 'uid', 'new', false); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(1, count($data['uid'])); @@ -103,7 +103,7 @@ public function testSimpleSetAttribute() public function testSimpleOverwriteAttribute() { $data=array('uid' => array('old')); - LDAP\Attribute::setAttribute($data, 'uid', 'new', false); + Ldap\Attribute::setAttribute($data, 'uid', 'new', false); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(1, count($data['uid'])); @@ -113,7 +113,7 @@ public function testSimpleOverwriteAttribute() public function testSimpleAppendAttribute() { $data=array('uid' => array('old')); - LDAP\Attribute::setAttribute($data, 'uid', 'new', true); + Ldap\Attribute::setAttribute($data, 'uid', 'new', true); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(2, count($data['uid'])); @@ -129,18 +129,18 @@ public function testBooleanAttributeHandling() 'p1_true' => array('TRUE'), 'p1_false' => array('FALSE') ); - LDAP\Attribute::setAttribute($data, 'p2_true', true); - LDAP\Attribute::setAttribute($data, 'p2_false', false); + Ldap\Attribute::setAttribute($data, 'p2_true', true); + Ldap\Attribute::setAttribute($data, 'p2_false', false); $this->assertEquals('TRUE', $data['p2_true'][0]); $this->assertEquals('FALSE', $data['p2_false'][0]); - $this->assertEquals(true, LDAP\Attribute::getAttribute($data, 'p1_true', 0)); - $this->assertEquals(false, LDAP\Attribute::getAttribute($data, 'p1_false', 0)); + $this->assertEquals(true, Ldap\Attribute::getAttribute($data, 'p1_true', 0)); + $this->assertEquals(false, Ldap\Attribute::getAttribute($data, 'p1_false', 0)); } public function testArraySetAttribute() { $data=array(); - LDAP\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), false); + Ldap\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), false); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(2, count($data['uid'])); @@ -153,7 +153,7 @@ public function testArraySetAttribute() public function testArrayOverwriteAttribute() { $data=array('uid' => array('old')); - LDAP\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), false); + Ldap\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), false); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(2, count($data['uid'])); @@ -166,7 +166,7 @@ public function testArrayOverwriteAttribute() public function testArrayAppendAttribute() { $data=array('uid' => array('old')); - LDAP\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), true); + Ldap\Attribute::setAttribute($data, 'uid', array('new1', 'new2'), true); $this->assertArrayHasKey('uid', $data); $this->assertType('array', $data['uid']); $this->assertEquals(3, count($data['uid'])); @@ -181,33 +181,33 @@ public function testArrayAppendAttribute() public function testPasswordSettingSHA() { $data=array(); - LDAP\Attribute::setPassword($data, 'pa$$w0rd', LDAP\Attribute::PASSWORD_HASH_SHA); - $password=LDAP\Attribute::getAttribute($data, 'userPassword', 0); + Ldap\Attribute::setPassword($data, 'pa$$w0rd', Ldap\Attribute::PASSWORD_HASH_SHA); + $password=Ldap\Attribute::getAttribute($data, 'userPassword', 0); $this->assertEquals('{SHA}vi3X+3ptD4ulrdErXo+3W72mRyE=', $password); } public function testPasswordSettingMD5() { $data=array(); - LDAP\Attribute::setPassword($data, 'pa$$w0rd', LDAP\Attribute::PASSWORD_HASH_MD5); - $password=LDAP\Attribute::getAttribute($data, 'userPassword', 0); + Ldap\Attribute::setPassword($data, 'pa$$w0rd', Ldap\Attribute::PASSWORD_HASH_MD5); + $password=Ldap\Attribute::getAttribute($data, 'userPassword', 0); $this->assertEquals('{MD5}bJuLJ96h3bhF+WqiVnxnVA==', $password); } public function testPasswordSettingUnicodePwd() { $data=array(); - LDAP\Attribute::setPassword($data, 'new', LDAP\Attribute::PASSWORD_UNICODEPWD); - $password=LDAP\Attribute::getAttribute($data, 'unicodePwd', 0); + Ldap\Attribute::setPassword($data, 'new', Ldap\Attribute::PASSWORD_UNICODEPWD); + $password=Ldap\Attribute::getAttribute($data, 'unicodePwd', 0); $this->assertEquals("\x22\x00\x6E\x00\x65\x00\x77\x00\x22\x00", $password); } public function testPasswordSettingCustomAttribute() { $data=array(); - LDAP\Attribute::setPassword($data, 'pa$$w0rd', - LDAP\Attribute::PASSWORD_HASH_SHA, 'myAttribute'); - $password=LDAP\Attribute::getAttribute($data, 'myAttribute', 0); + Ldap\Attribute::setPassword($data, 'pa$$w0rd', + Ldap\Attribute::PASSWORD_HASH_SHA, 'myAttribute'); + $password=Ldap\Attribute::getAttribute($data, 'myAttribute', 0); $this->assertNotNull($password); } @@ -218,7 +218,7 @@ public function testSetAttributeWithObject() $object->a=1; $object->b=1.23; $object->c='string'; - LDAP\Attribute::setAttribute($data, 'object', $object); + Ldap\Attribute::setAttribute($data, 'object', $object); $this->assertEquals(serialize($object), $data['object'][0]); } @@ -226,7 +226,7 @@ public function testSetAttributeWithFilestream() { $data=array(); $stream=fopen(__DIR__ . '/_files/AttributeTest.input.txt', 'r'); - LDAP\Attribute::setAttribute($data, 'file', $stream); + Ldap\Attribute::setAttribute($data, 'file', $stream); fclose($stream); $this->assertEquals('String from file', $data['file'][0]); } @@ -235,7 +235,7 @@ public function testSetDateTimeValueLocal() { $ts=mktime(12, 30, 30, 6, 25, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); $this->_assertLocalDateTimeString($ts, $data['ts'][0]); } @@ -243,7 +243,7 @@ public function testSetDateTimeValueUtc() { $ts=mktime(12, 30, 30, 6, 25, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, true); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, true); $this->_assertUtcDateTimeString($ts, $data['ts'][0]); } @@ -253,7 +253,7 @@ public function testSetDateTimeValueLocalArray() $ts[]=mktime(12, 30, 30, 6, 25, 2008); $ts[]=mktime(1, 25, 30, 1, 2, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); $this->_assertLocalDateTimeString($ts[0], $data['ts'][0]); $this->_assertLocalDateTimeString($ts[1], $data['ts'][1]); } @@ -262,7 +262,7 @@ public function testSetDateTimeValueIllegal() { $ts='dummy'; $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); $this->assertEquals(0, count($data['ts'])); } @@ -270,9 +270,9 @@ public function testGetDateTimeValueFromLocal() { $ts=mktime(12, 30, 30, 6, 25, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); $this->_assertLocalDateTimeString($ts, $data['ts'][0]); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts', 0); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts', 0); $this->assertEquals($ts, $retTs); } @@ -280,9 +280,9 @@ public function testGetDateTimeValueFromUtc() { $ts=mktime(12, 30, 30, 6, 25, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, true); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, true); $this->_assertUtcDateTimeString($ts, $data['ts'][0]); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts', 0); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts', 0); $this->assertEquals($ts, $retTs); } @@ -292,10 +292,10 @@ public function testGetDateTimeValueFromArray() $ts[]=mktime(12, 30, 30, 6, 25, 2008); $ts[]=mktime(1, 25, 30, 1, 2, 2008); $data=array(); - LDAP\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); + Ldap\Attribute::setDateTimeAttribute($data, 'ts', $ts, false); $this->_assertLocalDateTimeString($ts[0], $data['ts'][0]); $this->_assertLocalDateTimeString($ts[1], $data['ts'][1]); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts'); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts'); $this->assertEquals($ts[0], $retTs[0]); $this->assertEquals($ts[1], $retTs[1]); } @@ -303,14 +303,14 @@ public function testGetDateTimeValueFromArray() public function testGetDateTimeValueIllegal() { $data=array('ts' => array('dummy')); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts', 0); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts', 0); $this->assertEquals('dummy', $retTs); } public function testGetDateTimeValueNegativeOffet() { $data=array('ts' => array('20080612143045-0700')); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts', 0); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts', 0); $tsCompare=gmmktime(21, 30, 45, 6, 12, 2008); $this->assertEquals($tsCompare, $retTs); } @@ -318,7 +318,7 @@ public function testGetDateTimeValueNegativeOffet() public function testGetDateTimeValueNegativeOffet2() { $data=array('ts' => array('20080612143045-0715')); - $retTs=LDAP\Attribute::getDateTimeAttribute($data, 'ts', 0); + $retTs=Ldap\Attribute::getDateTimeAttribute($data, 'ts', 0); $tsCompare=gmmktime(21, 45, 45, 6, 12, 2008); $this->assertEquals($tsCompare, $retTs); } @@ -326,7 +326,7 @@ public function testGetDateTimeValueNegativeOffet2() public function testRemoveAttributeValueSimple() { $data=array('test' => array('value1', 'value2', 'value3', 'value3')); - LDAP\Attribute::removeFromAttribute($data, 'test', 'value2'); + Ldap\Attribute::removeFromAttribute($data, 'test', 'value2'); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(3, count($data['test'])); @@ -338,7 +338,7 @@ public function testRemoveAttributeValueSimple() public function testRemoveAttributeValueArray() { $data=array('test' => array('value1', 'value2', 'value3', 'value3')); - LDAP\Attribute::removeFromAttribute($data, 'test', array('value1', 'value2')); + Ldap\Attribute::removeFromAttribute($data, 'test', array('value1', 'value2')); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(2, count($data['test'])); @@ -350,7 +350,7 @@ public function testRemoveAttributeValueArray() public function testRemoveAttributeMultipleValueSimple() { $data=array('test' => array('value1', 'value2', 'value3', 'value3')); - LDAP\Attribute::removeFromAttribute($data, 'test', 'value3'); + Ldap\Attribute::removeFromAttribute($data, 'test', 'value3'); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(2, count($data['test'])); @@ -362,7 +362,7 @@ public function testRemoveAttributeMultipleValueSimple() public function testRemoveAttributeMultipleValueArray() { $data=array('test' => array('value1', 'value2', 'value3', 'value3')); - LDAP\Attribute::removeFromAttribute($data, 'test', array('value1', 'value3')); + Ldap\Attribute::removeFromAttribute($data, 'test', array('value1', 'value3')); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(1, count($data['test'])); @@ -374,7 +374,7 @@ public function testRemoveAttributeMultipleValueArray() public function testRemoveAttributeValueBoolean() { $data=array('test' => array('TRUE', 'FALSE', 'TRUE', 'FALSE')); - LDAP\Attribute::removeFromAttribute($data, 'test', false); + Ldap\Attribute::removeFromAttribute($data, 'test', false); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(2, count($data['test'])); @@ -385,7 +385,7 @@ public function testRemoveAttributeValueBoolean() public function testRemoveAttributeValueInteger() { $data=array('test' => array('1', '2', '3', '4')); - LDAP\Attribute::removeFromAttribute($data, 'test', array(2, 4)); + Ldap\Attribute::removeFromAttribute($data, 'test', array(2, 4)); $this->assertArrayHasKey('test', $data); $this->assertType('array', $data['test']); $this->assertEquals(2, count($data['test'])); @@ -397,28 +397,28 @@ public function testRemoveAttributeValueInteger() public function testConvertFromLDAPValue() { - $this->assertEquals(true, LDAP\Attribute::convertFromLDAPValue('TRUE')); - $this->assertEquals(false, LDAP\Attribute::convertFromLDAPValue('FALSE')); + $this->assertEquals(true, Ldap\Attribute::convertFromLDAPValue('TRUE')); + $this->assertEquals(false, Ldap\Attribute::convertFromLDAPValue('FALSE')); } public function testConvertToLDAPValue() { - $this->assertEquals('string', LDAP\Attribute::convertToLDAPValue('string')); - $this->assertEquals('1', LDAP\Attribute::convertToLDAPValue(1)); - $this->assertEquals('TRUE', LDAP\Attribute::convertToLDAPValue(true)); + $this->assertEquals('string', Ldap\Attribute::convertToLDAPValue('string')); + $this->assertEquals('1', Ldap\Attribute::convertToLDAPValue(1)); + $this->assertEquals('TRUE', Ldap\Attribute::convertToLDAPValue(true)); } public function testConvertFromLDAPDateTimeValue() { $ldap='20080625123030+0200'; $this->assertEquals(gmmktime(10, 30, 30, 6, 25, 2008), - LDAP\Attribute::convertFromLDAPDateTimeValue($ldap)); + Ldap\Attribute::convertFromLDAPDateTimeValue($ldap)); } public function testConvertToLDAPDateTimeValue() { $ts=mktime(12, 30, 30, 6, 25, 2008); - $this->_assertLocalDateTimeString($ts, LDAP\Attribute::convertToLDAPDateTimeValue($ts)); + $this->_assertLocalDateTimeString($ts, Ldap\Attribute::convertToLDAPDateTimeValue($ts)); } public function testRemoveDuplicates() @@ -435,10 +435,10 @@ public function testRemoveDuplicates() 'boolean1' => array('TRUE'), 'boolean2' => array('TRUE', 'FALSE'), ); - LDAP\Attribute::removeDuplicatesFromAttribute($data, 'strings1'); - LDAP\Attribute::removeDuplicatesFromAttribute($data, 'strings2'); - LDAP\Attribute::removeDuplicatesFromAttribute($data, 'boolean1'); - LDAP\Attribute::removeDuplicatesFromAttribute($data, 'boolean2'); + Ldap\Attribute::removeDuplicatesFromAttribute($data, 'strings1'); + Ldap\Attribute::removeDuplicatesFromAttribute($data, 'strings2'); + Ldap\Attribute::removeDuplicatesFromAttribute($data, 'boolean1'); + Ldap\Attribute::removeDuplicatesFromAttribute($data, 'boolean2'); $this->assertEquals($expected, $data); } @@ -451,30 +451,30 @@ public function testHasValue() 'boolean2' => array('TRUE', 'FALSE', 'TRUE', 'FALSE'), ); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'strings1', 'value1')); - $this->assertFalse(LDAP\Attribute::attributeHasValue($data, 'strings1', 'value4')); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'boolean1', true)); - $this->assertFalse(LDAP\Attribute::attributeHasValue($data, 'boolean1', false)); + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'strings1', 'value1')); + $this->assertFalse(Ldap\Attribute::attributeHasValue($data, 'strings1', 'value4')); + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'boolean1', true)); + $this->assertFalse(Ldap\Attribute::attributeHasValue($data, 'boolean1', false)); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'strings1', + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2'))); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'strings1', + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2', 'value3'))); - $this->assertFalse(LDAP\Attribute::attributeHasValue($data, 'strings1', + $this->assertFalse(Ldap\Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2', 'value3', 'value4'))); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'strings2', + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'strings2', array('value1', 'value2', 'value3', 'value4'))); - $this->assertTrue(LDAP\Attribute::attributeHasValue($data, 'boolean2', + $this->assertTrue(Ldap\Attribute::attributeHasValue($data, 'boolean2', array(true, false))); - $this->assertFalse(LDAP\Attribute::attributeHasValue($data, 'boolean1', + $this->assertFalse(Ldap\Attribute::attributeHasValue($data, 'boolean1', array(true, false))); } public function testPasswordGenerationSSHA() { $password = 'pa$$w0rd'; - $ssha = LDAP\Attribute::createPassword($password, LDAP\Attribute::PASSWORD_HASH_SSHA); + $ssha = Ldap\Attribute::createPassword($password, Ldap\Attribute::PASSWORD_HASH_SSHA); $encoded = substr($ssha, strpos($ssha, '}')); $binary = base64_decode($encoded); $this->assertEquals(24, strlen($binary)); @@ -487,7 +487,7 @@ public function testPasswordGenerationSSHA() public function testPasswordGenerationSHA() { $password = 'pa$$w0rd'; - $sha = LDAP\Attribute::createPassword($password, LDAP\Attribute::PASSWORD_HASH_SHA); + $sha = Ldap\Attribute::createPassword($password, Ldap\Attribute::PASSWORD_HASH_SHA); $encoded = substr($sha, strpos($sha, '}')); $binary = base64_decode($encoded); $this->assertEquals(20, strlen($binary)); @@ -497,7 +497,7 @@ public function testPasswordGenerationSHA() public function testPasswordGenerationSMD5() { $password = 'pa$$w0rd'; - $smd5 = LDAP\Attribute::createPassword($password, LDAP\Attribute::PASSWORD_HASH_SMD5); + $smd5 = Ldap\Attribute::createPassword($password, Ldap\Attribute::PASSWORD_HASH_SMD5); $encoded = substr($smd5, strpos($smd5, '}')); $binary = base64_decode($encoded); $this->assertEquals(20, strlen($binary)); @@ -510,7 +510,7 @@ public function testPasswordGenerationSMD5() public function testPasswordGenerationMD5() { $password = 'pa$$w0rd'; - $md5 = LDAP\Attribute::createPassword($password, LDAP\Attribute::PASSWORD_HASH_MD5); + $md5 = Ldap\Attribute::createPassword($password, Ldap\Attribute::PASSWORD_HASH_MD5); $encoded = substr($md5, strpos($md5, '}')); $binary = base64_decode($encoded); $this->assertEquals(16, strlen($binary)); @@ -520,7 +520,7 @@ public function testPasswordGenerationMD5() public function testPasswordGenerationUnicodePwd() { $password = 'new'; - $unicodePwd = LDAP\Attribute::createPassword($password, LDAP\Attribute::PASSWORD_UNICODEPWD); + $unicodePwd = Ldap\Attribute::createPassword($password, Ldap\Attribute::PASSWORD_UNICODEPWD); $this->assertEquals(10, strlen($unicodePwd)); $this->assertEquals("\x22\x00\x6E\x00\x65\x00\x77\x00\x22\x00", $unicodePwd); } diff --git a/tests/Zend/LDAP/BindTest.php b/tests/Zend/Ldap/BindTest.php similarity index 87% rename from tests/Zend/LDAP/BindTest.php rename to tests/Zend/Ldap/BindTest.php index dd41b93507b..85750570399 100644 --- a/tests/Zend/LDAP/BindTest.php +++ b/tests/Zend/Ldap/BindTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /* Note: The ldap_connect function does not actually try to connect. This * is why many tests attempt to bind with invalid credentials. If the @@ -82,11 +82,11 @@ public function setUp() public function testEmptyOptionsBind() { - $ldap = new LDAP\LDAP(array()); + $ldap = new Ldap\Ldap(array()); try { $ldap->bind(); $this->fail('Expected exception for empty options'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('A host parameter is required', $zle->getMessage()); } } @@ -95,10 +95,10 @@ public function testAnonymousBind() $options = $this->_options; unset($options['password']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind(); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { // or I guess the server doesn't allow unauthenticated binds $this->assertContains('unauthenticated bind', $zle->getMessage()); } @@ -109,11 +109,11 @@ public function testNoBaseDnBind() unset($options['baseDn']); $options['bindRequiresDn'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind('invalid', 'ignored'); $this->fail('Expected exception for baseDn missing'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Base DN not set', $zle->getMessage()); } } @@ -122,25 +122,25 @@ public function testNoDomainNameBind() $options = $this->_options; unset($options['accountDomainName']); $options['bindRequiresDn'] = false; - $options['accountCanonicalForm'] = LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL; + $options['accountCanonicalForm'] = Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind('invalid', 'ignored'); $this->fail('Expected exception for missing accountDomainName'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Option required: accountDomainName', $zle->getMessage()); } } public function testPlainBind() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); $ldap->bind(); $this->assertNotNull($ldap->getResource()); } public function testConnectBind() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); $ldap->connect()->bind(); $this->assertNotNull($ldap->getResource()); } @@ -153,7 +153,7 @@ public function testExplicitParamsBind() unset($options['username']); unset($options['password']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $ldap->bind($username, $password); $this->assertNotNull($ldap->getResource()); } @@ -163,11 +163,11 @@ public function testRequiresDnBind() $options['bindRequiresDn'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind($this->_altUsername, 'invalid'); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } @@ -179,11 +179,11 @@ public function testRequiresDnWithoutDnBind() unset($options['username']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind($this->_principalName); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { /* Note that if your server actually allows anonymous binds this test will fail. */ $this->assertContains('Failed to retrieve DN', $zle->getMessage()); @@ -194,20 +194,20 @@ public function testBindWithEmptyPassword() { $options = $this->_options; $options['allowEmptyPassword'] = false; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind($this->_altUsername, ''); $this->fail('Expected exception for empty password'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Empty password not allowed - see allowEmptyPassword option.', $zle->getMessage()); } $options['allowEmptyPassword'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind($this->_altUsername, ''); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { if ($zle->getMessage() === 'Empty password not allowed - see allowEmptyPassword option.') { $this->fail('Exception for empty password'); @@ -226,11 +226,11 @@ public function testBindWithoutDnUsernameAndDnRequired() $options = $this->_options; $options['username'] = TESTS_ZEND_LDAP_ALT_USERNAME; $options['bindRequiresDn'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->bind(); $this->fail('Expected exception for empty password'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Binding requires username in DN form', $zle->getMessage()); } @@ -241,7 +241,7 @@ public function testBindWithoutDnUsernameAndDnRequired() */ public function testBoundUserIsFalseIfNotBoundToLDAP() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); $this->assertFalse($ldap->getBoundUser()); } @@ -250,7 +250,7 @@ public function testBoundUserIsFalseIfNotBoundToLDAP() */ public function testBoundUserIsReturnedAfterBinding() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); $ldap->bind(); $this->assertEquals(TESTS_ZEND_LDAP_USERNAME, $ldap->getBoundUser()); } @@ -260,7 +260,7 @@ public function testBoundUserIsReturnedAfterBinding() */ public function testResourceIsAlwaysReturned() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); $this->assertNotNull($ldap->getResource()); $this->assertTrue(is_resource($ldap->getResource())); $this->assertEquals(TESTS_ZEND_LDAP_USERNAME, $ldap->getBoundUser()); diff --git a/tests/Zend/LDAP/CanonTest.php b/tests/Zend/Ldap/CanonTest.php similarity index 80% rename from tests/Zend/LDAP/CanonTest.php rename to tests/Zend/Ldap/CanonTest.php index 53944e39c3a..4ccedff5909 100644 --- a/tests/Zend/LDAP/CanonTest.php +++ b/tests/Zend/Ldap/CanonTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /* Note: The ldap_connect function does not actually try to connect. This * is why many tests attempt to bind with invalid credentials. If the @@ -74,19 +74,19 @@ public function setUp() public function testPlainCanon() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); /* This test tries to canonicalize each name (uname, uname@example.com, * EXAMPLE\uname) to each of the 3 forms (username, principal and backslash) * for a total of canonicalizations. */ if (defined('TESTS_ZEND_LDAP_ALT_USERNAME')) { - $names[LDAP\LDAP::ACCTNAME_FORM_USERNAME] = TESTS_ZEND_LDAP_ALT_USERNAME; + $names[Ldap\Ldap::ACCTNAME_FORM_USERNAME] = TESTS_ZEND_LDAP_ALT_USERNAME; if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME')) { - $names[LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL] = + $names[Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL] = TESTS_ZEND_LDAP_ALT_USERNAME . '@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME; } if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT')) { - $names[LDAP\LDAP::ACCTNAME_FORM_BACKSLASH] = + $names[Ldap\Ldap::ACCTNAME_FORM_BACKSLASH] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\' . TESTS_ZEND_LDAP_ALT_USERNAME; } } @@ -101,11 +101,11 @@ public function testPlainCanon() public function testInvalidAccountCanon() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); try { $ldap->bind('invalid', 'invalid'); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $msg = $zle->getMessage(); $this->assertTrue(strstr($msg, 'Invalid credentials') || strstr($msg, 'No such object') || @@ -115,56 +115,56 @@ public function testInvalidAccountCanon() public function testDnCanon() { - $ldap = new LDAP\LDAP($this->_options); - $name = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, LDAP\LDAP::ACCTNAME_FORM_DN); + $ldap = new Ldap\Ldap($this->_options); + $name = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, Ldap\Ldap::ACCTNAME_FORM_DN); $this->assertEquals(TESTS_ZEND_LDAP_ALT_DN, $name); } public function testMismatchDomainBind() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); try { $ldap->bind('BOGUS\\doesntmatter', 'doesntmatter'); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { - $this->assertTrue($zle->getCode() == LDAP\Exception::LDAP_X_DOMAIN_MISMATCH); + } catch (Ldap\Exception $zle) { + $this->assertTrue($zle->getCode() == Ldap\Exception::LDAP_X_DOMAIN_MISMATCH); } } public function testAccountCanonization() { $options = $this->_options; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $canonDn = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_DN); + Ldap\Ldap::ACCTNAME_FORM_DN); $this->assertEquals(TESTS_ZEND_LDAP_ALT_DN, $canonDn); $canonUsername = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->assertEquals(TESTS_ZEND_LDAP_ALT_USERNAME, $canonUsername); $canonBackslash = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_BACKSLASH); + Ldap\Ldap::ACCTNAME_FORM_BACKSLASH); $this->assertEquals( TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\' . TESTS_ZEND_LDAP_ALT_USERNAME, $canonBackslash); $canonPrincipal = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL); + Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL); $this->assertEquals( TESTS_ZEND_LDAP_ALT_USERNAME . '@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, $canonPrincipal); - $options['accountCanonicalForm'] = LDAP\LDAP::ACCTNAME_FORM_USERNAME; + $options['accountCanonicalForm'] = Ldap\Ldap::ACCTNAME_FORM_USERNAME; $ldap->setOptions($options); $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME); $this->assertEquals(TESTS_ZEND_LDAP_ALT_USERNAME, $canon); - $options['accountCanonicalForm'] = LDAP\LDAP::ACCTNAME_FORM_BACKSLASH; + $options['accountCanonicalForm'] = Ldap\Ldap::ACCTNAME_FORM_BACKSLASH; $ldap->setOptions($options); $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME); $this->assertEquals( TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\' . TESTS_ZEND_LDAP_ALT_USERNAME, $canon); - $options['accountCanonicalForm'] = LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL; + $options['accountCanonicalForm'] = Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL; $ldap->setOptions($options); $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME); $this->assertEquals( @@ -196,20 +196,20 @@ public function testDefaultAccountFilterFormat() unset($options['accountFilterFormat']); $options['bindRequiresDn'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { - $canon = $ldap->getCanonicalAccountName('invalid', LDAP\LDAP::ACCTNAME_FORM_DN); + $canon = $ldap->getCanonicalAccountName('invalid', Ldap\Ldap::ACCTNAME_FORM_DN); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('(&(objectClass=posixAccount)(uid=invalid))', $zle->getMessage()); } $options['bindRequiresDn'] = false; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { - $canon = $ldap->getCanonicalAccountName('invalid', LDAP\LDAP::ACCTNAME_FORM_DN); + $canon = $ldap->getCanonicalAccountName('invalid', Ldap\Ldap::ACCTNAME_FORM_DN); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('(&(objectClass=user)(sAMAccountName=invalid))', $zle->getMessage()); } } @@ -217,34 +217,34 @@ public function testDefaultAccountFilterFormat() public function testPossibleAuthority() { $options = $this->_options; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName('invalid\invalid', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Binding domain is not an authority for user: invalid\invalid', $zle->getMessage()); } try { $canon = $ldap->getCanonicalAccountName('invalid@invalid.tld', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Binding domain is not an authority for user: invalid@invalid.tld', $zle->getMessage()); } unset($options['accountDomainName']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\invalid', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->assertEquals('invalid', $canon); try { $canon = $ldap->getCanonicalAccountName('invalid@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Binding domain is not an authority for user: invalid@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, $zle->getMessage()); @@ -252,41 +252,41 @@ public function testPossibleAuthority() unset($options['accountDomainNameShort']); $options['accountDomainName'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\invalid', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Binding domain is not an authority for user: ' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\invalid', $zle->getMessage()); } $canon = $ldap->getCanonicalAccountName('invalid@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->assertEquals('invalid', $canon); unset($options['accountDomainName']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\invalid', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->assertEquals('invalid', $canon); $canon = $ldap->getCanonicalAccountName('invalid@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->assertEquals('invalid', $canon); } public function testInvalidAccountName() { $options = $this->_options; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName('0@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid account name syntax: 0@' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME, $zle->getMessage()); @@ -294,9 +294,9 @@ public function testInvalidAccountName() try { $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\0', - LDAP\LDAP::ACCTNAME_FORM_USERNAME); + Ldap\Ldap::ACCTNAME_FORM_USERNAME); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid account name syntax: ' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\0', $zle->getMessage()); @@ -306,12 +306,12 @@ public function testInvalidAccountName() public function testGetUnknownCanonicalForm() { $options = $this->_options; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, 99); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Unknown canonical name form: 99', $zle->getMessage()); } @@ -321,23 +321,23 @@ public function testGetUnavailableCanoncialForm() { $options = $this->_options; unset($options['accountDomainName']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL); + Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Option required: accountDomainName', $zle->getMessage()); } unset($options['accountDomainNameShort']); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $canon = $ldap->getCanonicalAccountName(TESTS_ZEND_LDAP_ALT_USERNAME, - LDAP\LDAP::ACCTNAME_FORM_BACKSLASH); + Ldap\Ldap::ACCTNAME_FORM_BACKSLASH); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Option required: accountDomainNameShort', $zle->getMessage()); } @@ -349,22 +349,22 @@ public function testSplittingOption() unset($options['accountDomainName']); unset($options['accountDomainNameShort']); $options['tryUsernameSplit'] = true; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $this->assertEquals('username', $ldap->getCanonicalAccountName('username@example.com', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('username', $ldap->getCanonicalAccountName('EXAMPLE\username', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('username', $ldap->getCanonicalAccountName('username', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $options['tryUsernameSplit'] = false; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $this->assertEquals('username@example.com', - $ldap->getCanonicalAccountName('username@example.com', LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + $ldap->getCanonicalAccountName('username@example.com', Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('example\username', $ldap->getCanonicalAccountName('EXAMPLE\username', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('username', $ldap->getCanonicalAccountName('username', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); } @@ -376,27 +376,27 @@ public function testSpecialCharacterInUsername() $options = $this->_options; $options['accountDomainName'] = 'example.com'; $options['accountDomainNameShort'] = 'EXAMPLE'; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $this->assertEquals('schäfer', $ldap->getCanonicalAccountName('SCHÄFER@example.com', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('schäfer', $ldap->getCanonicalAccountName('EXAMPLE\SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('schäfer', $ldap->getCanonicalAccountName('SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_USERNAME)); + Ldap\Ldap::ACCTNAME_FORM_USERNAME)); $this->assertEquals('schäfer@example.com', $ldap->getCanonicalAccountName('SCHÄFER@example.com', - LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL)); + Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL)); $this->assertEquals('schäfer@example.com', $ldap->getCanonicalAccountName('EXAMPLE\SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL)); + Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL)); $this->assertEquals('schäfer@example.com', $ldap->getCanonicalAccountName('SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_PRINCIPAL)); + Ldap\Ldap::ACCTNAME_FORM_PRINCIPAL)); $this->assertEquals('EXAMPLE\schäfer', $ldap->getCanonicalAccountName('SCHÄFER@example.com', - LDAP\LDAP::ACCTNAME_FORM_BACKSLASH)); + Ldap\Ldap::ACCTNAME_FORM_BACKSLASH)); $this->assertEquals('EXAMPLE\schäfer', $ldap->getCanonicalAccountName('EXAMPLE\SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_BACKSLASH)); + Ldap\Ldap::ACCTNAME_FORM_BACKSLASH)); $this->assertEquals('EXAMPLE\schäfer', $ldap->getCanonicalAccountName('SCHÄFER', - LDAP\LDAP::ACCTNAME_FORM_BACKSLASH)); + Ldap\Ldap::ACCTNAME_FORM_BACKSLASH)); } } diff --git a/tests/Zend/LDAP/ChangePasswordTest.php b/tests/Zend/Ldap/ChangePasswordTest.php similarity index 67% rename from tests/Zend/LDAP/ChangePasswordTest.php rename to tests/Zend/Ldap/ChangePasswordTest.php index ade0830029a..6642fa57a5f 100644 --- a/tests/Zend/LDAP/ChangePasswordTest.php +++ b/tests/Zend/Ldap/ChangePasswordTest.php @@ -23,9 +23,9 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP\Node\RootDSE; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap\Node\RootDse; +use Zend\Ldap; /** * @category Zend @@ -41,27 +41,27 @@ class ChangePasswordTest extends OnlineTestCase public function testAddNewUserWithPasswordOpenLDAP() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } $dn = $this->_createDn('uid=newuser,'); $data = array(); $password = 'pa$$w0rd'; - LDAP\Attribute::setAttribute($data, 'uid', 'newuser', false); - LDAP\Attribute::setAttribute($data, 'objectClass', 'account', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'simpleSecurityObject', true); - LDAP\Attribute::setPassword($data, $password, - LDAP\Attribute::PASSWORD_HASH_SSHA, 'userPassword'); + Ldap\Attribute::setAttribute($data, 'uid', 'newuser', false); + Ldap\Attribute::setAttribute($data, 'objectClass', 'account', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'simpleSecurityObject', true); + Ldap\Attribute::setPassword($data, $password, + Ldap\Attribute::PASSWORD_HASH_SSHA, 'userPassword'); try { $this->_getLDAP()->add($dn, $data); - $this->assertType('Zend\LDAP\LDAP', $this->_getLDAP()->bind($dn, $password)); + $this->assertType('Zend\Ldap\Ldap', $this->_getLDAP()->bind($dn, $password)); $this->_getLDAP()->bind(); $this->_getLDAP()->delete($dn); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->_getLDAP()->bind(); if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); @@ -73,18 +73,18 @@ public function testAddNewUserWithPasswordOpenLDAP() public function testChangePasswordWithUserAccountOpenLDAP() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } $dn = $this->_createDn('uid=newuser,'); $data = array(); $password = 'pa$$w0rd'; - LDAP\Attribute::setAttribute($data, 'uid', 'newuser', false); - LDAP\Attribute::setAttribute($data, 'objectClass', 'account', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'simpleSecurityObject', true); - LDAP\Attribute::setPassword($data, $password, - LDAP\Attribute::PASSWORD_HASH_SSHA, 'userPassword'); + Ldap\Attribute::setAttribute($data, 'uid', 'newuser', false); + Ldap\Attribute::setAttribute($data, 'objectClass', 'account', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'simpleSecurityObject', true); + Ldap\Attribute::setPassword($data, $password, + Ldap\Attribute::PASSWORD_HASH_SSHA, 'userPassword'); try { $this->_getLDAP()->add($dn, $data); @@ -93,24 +93,24 @@ public function testChangePasswordWithUserAccountOpenLDAP() $newPasswd = 'newpasswd'; $newData = array(); - LDAP\Attribute::setPassword($newData, $newPasswd, - LDAP\Attribute::PASSWORD_HASH_SHA, 'userPassword'); + Ldap\Attribute::setPassword($newData, $newPasswd, + Ldap\Attribute::PASSWORD_HASH_SHA, 'userPassword'); $this->_getLDAP()->update($dn, $newData); try { $this->_getLDAP()->bind($dn, $password); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $message = $zle->getMessage(); $this->assertTrue(strstr($message, 'Invalid credentials') || strstr($message, 'Server is unwilling to perform')); } - $this->assertType('Zend\LDAP\LDAP', $this->_getLDAP()->bind($dn, $newPasswd)); + $this->assertType('Zend\Ldap\Ldap', $this->_getLDAP()->bind($dn, $newPasswd)); $this->_getLDAP()->bind(); $this->_getLDAP()->delete($dn); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->_getLDAP()->bind(); if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); @@ -122,7 +122,7 @@ public function testChangePasswordWithUserAccountOpenLDAP() public function testAddNewUserWithPasswordActiveDirectory() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_ACTIVEDIRECTORY) { + RootDse::SERVER_TYPE_ACTIVEDIRECTORY) { $this->markTestSkipped('Test can only be run on an ActiveDirectory server'); } $options = $this->_getLDAP()->getOptions(); @@ -133,15 +133,15 @@ public function testAddNewUserWithPasswordActiveDirectory() $dn = $this->_createDn('cn=New User,'); $data = array(); $password = 'pa$$w0rd'; - LDAP\Attribute::setAttribute($data, 'cn', 'New User', false); - LDAP\Attribute::setAttribute($data, 'displayName', 'New User', false); - LDAP\Attribute::setAttribute($data, 'sAMAccountName', 'newuser', false); - LDAP\Attribute::setAttribute($data, 'userAccountControl', 512, false); - LDAP\Attribute::setAttribute($data, 'objectClass', 'person', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'organizationalPerson', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'user', true); - LDAP\Attribute::setPassword($data, $password, - LDAP\Attribute::PASSWORD_UNICODEPWD, 'unicodePwd'); + Ldap\Attribute::setAttribute($data, 'cn', 'New User', false); + Ldap\Attribute::setAttribute($data, 'displayName', 'New User', false); + Ldap\Attribute::setAttribute($data, 'sAMAccountName', 'newuser', false); + Ldap\Attribute::setAttribute($data, 'userAccountControl', 512, false); + Ldap\Attribute::setAttribute($data, 'objectClass', 'person', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'organizationalPerson', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'user', true); + Ldap\Attribute::setPassword($data, $password, + Ldap\Attribute::PASSWORD_UNICODEPWD, 'unicodePwd'); try { $this->_getLDAP()->add($dn, $data); @@ -150,7 +150,7 @@ public function testAddNewUserWithPasswordActiveDirectory() $this->_getLDAP()->bind(); $this->_getLDAP()->delete($dn); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->_getLDAP()->bind(); if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); @@ -162,7 +162,7 @@ public function testAddNewUserWithPasswordActiveDirectory() public function testChangePasswordWithUserAccountActiveDirectory() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_ACTIVEDIRECTORY) { + RootDse::SERVER_TYPE_ACTIVEDIRECTORY) { $this->markTestSkipped('Test can only be run on an ActiveDirectory server'); } $options = $this->_getLDAP()->getOptions(); @@ -173,15 +173,15 @@ public function testChangePasswordWithUserAccountActiveDirectory() $dn = $this->_createDn('cn=New User,'); $data = array(); $password = 'pa$$w0rd'; - LDAP\Attribute::setAttribute($data, 'cn', 'New User', false); - LDAP\Attribute::setAttribute($data, 'displayName', 'New User', false); - LDAP\Attribute::setAttribute($data, 'sAMAccountName', 'newuser', false); - LDAP\Attribute::setAttribute($data, 'userAccountControl', 512, false); - LDAP\Attribute::setAttribute($data, 'objectClass', 'person', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'organizationalPerson', true); - LDAP\Attribute::setAttribute($data, 'objectClass', 'user', true); - LDAP\Attribute::setPassword($data, $password, - LDAP\Attribute::PASSWORD_UNICODEPWD, 'unicodePwd'); + Ldap\Attribute::setAttribute($data, 'cn', 'New User', false); + Ldap\Attribute::setAttribute($data, 'displayName', 'New User', false); + Ldap\Attribute::setAttribute($data, 'sAMAccountName', 'newuser', false); + Ldap\Attribute::setAttribute($data, 'userAccountControl', 512, false); + Ldap\Attribute::setAttribute($data, 'objectClass', 'person', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'organizationalPerson', true); + Ldap\Attribute::setAttribute($data, 'objectClass', 'user', true); + Ldap\Attribute::setPassword($data, $password, + Ldap\Attribute::PASSWORD_UNICODEPWD, 'unicodePwd'); try { $this->_getLDAP()->add($dn, $data); @@ -190,13 +190,13 @@ public function testChangePasswordWithUserAccountActiveDirectory() $newPasswd = 'newpasswd'; $newData = array(); - LDAP\Attribute::setPassword($newData, $newPasswd, LDAP\Attribute::PASSWORD_UNICODEPWD); + Ldap\Attribute::setPassword($newData, $newPasswd, Ldap\Attribute::PASSWORD_UNICODEPWD); $this->_getLDAP()->update($dn, $newData); try { $this->_getLDAP()->bind($dn, $password); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $message = $zle->getMessage(); $this->assertTrue(strstr($message, 'Invalid credentials') || strstr($message, 'Server is unwilling to perform')); @@ -206,7 +206,7 @@ public function testChangePasswordWithUserAccountActiveDirectory() $this->_getLDAP()->bind(); $this->_getLDAP()->delete($dn); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->_getLDAP()->bind(); if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); diff --git a/tests/Zend/LDAP/ConnectTest.php b/tests/Zend/Ldap/ConnectTest.php similarity index 86% rename from tests/Zend/LDAP/ConnectTest.php rename to tests/Zend/Ldap/ConnectTest.php index c8a5754d033..147f0d38325 100644 --- a/tests/Zend/LDAP/ConnectTest.php +++ b/tests/Zend/Ldap/ConnectTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /* Note: The ldap_connect function does not actually try to connect. This * is why many tests attempt to bind with invalid credentials. If the @@ -59,35 +59,35 @@ public function setUp() public function testEmptyOptionsConnect() { - $ldap = new LDAP\LDAP(array()); + $ldap = new Ldap\Ldap(array()); try { $ldap->connect(); $this->fail('Expected exception for empty options'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('host parameter is required', $zle->getMessage()); } } public function testUnknownHostConnect() { - $ldap = new LDAP\LDAP(array('host' => 'bogus.example.com')); + $ldap = new Ldap\Ldap(array('host' => 'bogus.example.com')); try { // connect doesn't actually try to connect until bind is called $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for unknown host'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Can\'t contact LDAP server', $zle->getMessage()); } } public function testPlainConnect() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); try { // Connect doesn't actually try to connect until bind is called // but if we get 'Invalid credentials' then we know the connect // succeeded. $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } @@ -101,12 +101,12 @@ public function testExplicitParamsConnect() if (defined('TESTS_ZEND_LDAP_USE_SSL')) $useSsl = TESTS_ZEND_LDAP_USE_SSL; - $ldap = new LDAP\LDAP(); + $ldap = new Ldap\Ldap(); try { $ldap->connect($host, $port, $useSsl) ->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } @@ -118,12 +118,12 @@ public function testExplicitPortConnect() if (defined('TESTS_ZEND_LDAP_USE_SSL') && TESTS_ZEND_LDAP_USE_SSL) $port = 636; - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); try { $ldap->connect(null, $port) ->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } @@ -132,46 +132,46 @@ public function testBadPortConnect() $options = $this->_options; $options['port'] = 10; - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); try { $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for unknown username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Can\'t contact LDAP server', $zle->getMessage()); } } public function testSetOptionsConnect() { - $ldap = new LDAP\LDAP(); + $ldap = new Ldap\Ldap(); $ldap->setOptions($this->_options); try { $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } public function testMultiConnect() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); for ($i = 0; $i < 3; $i++) { try { $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for unknown username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } } public function testDisconnect() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); for ($i = 0; $i < 3; $i++) { $ldap->disconnect(); try { $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for unknown username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } @@ -179,19 +179,19 @@ public function testDisconnect() public function testGetErrorCode() { - $ldap = new LDAP\LDAP($this->_options); + $ldap = new Ldap\Ldap($this->_options); try { // Connect doesn't actually try to connect until bind is called // but if we get 'Invalid credentials' then we know the connect // succeeded. $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); $this->assertEquals(0x31, $zle->getCode()); - $this->assertEquals(0x0, LDAP\Exception::getLDAPCode($ldap)); - $this->assertEquals(0x0, LDAP\Exception::getLDAPCode(null)); + $this->assertEquals(0x0, Ldap\Exception::getLDAPCode($ldap)); + $this->assertEquals(0x0, Ldap\Exception::getLDAPCode(null)); } } @@ -214,12 +214,12 @@ public function testConnectWithUri() $host = $host . ':' . $port; } - $ldap = new LDAP\LDAP(); + $ldap = new Ldap\Ldap(); try { $ldap->connect($host) ->bind('CN=ignored,DC=example,DC=com', 'ignored'); $this->fail('Expected exception for invalid username'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains('Invalid credentials', $zle->getMessage()); } } diff --git a/tests/Zend/LDAP/ConverterTest.php b/tests/Zend/Ldap/ConverterTest.php similarity index 91% rename from tests/Zend/LDAP/ConverterTest.php rename to tests/Zend/Ldap/ConverterTest.php index c7836a09ab0..99c1929103b 100644 --- a/tests/Zend/LDAP/ConverterTest.php +++ b/tests/Zend/Ldap/ConverterTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** @@ -46,7 +46,7 @@ public function testAsc2hex32() for ($i=0; $i<127; $i++) { $str.=chr($i); } - $this->assertEquals($expected, LDAP\Converter::ascToHex32($str)); + $this->assertEquals($expected, Ldap\Converter::ascToHex32($str)); } public function testHex2asc() @@ -59,7 +59,7 @@ public function testHex2asc() $str='\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f\10\11\12\13\14\15\16\17\18\19\1a\1b' . '\1c\1d\1e\1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg' . 'hijklmnopqrstuvwxyz{|}~'; - $this->assertEquals($expected, LDAP\Converter::hex32ToAsc($str)); + $this->assertEquals($expected, Ldap\Converter::hex32ToAsc($str)); } } diff --git a/tests/Zend/LDAP/CopyRenameTest.php b/tests/Zend/Ldap/CopyRenameTest.php similarity index 90% rename from tests/Zend/LDAP/CopyRenameTest.php rename to tests/Zend/Ldap/CopyRenameTest.php index efd6ed87963..f069c904bdc 100644 --- a/tests/Zend/LDAP/CopyRenameTest.php +++ b/tests/Zend/Ldap/CopyRenameTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** @@ -145,7 +145,7 @@ public function testSimpleLeafMoveToSubtree() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameSourceNotExists() { @@ -153,7 +153,7 @@ public function testRenameSourceNotExists() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameTargetExists() { @@ -161,7 +161,7 @@ public function testRenameTargetExists() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameTargetParentNotExists() { @@ -169,7 +169,7 @@ public function testRenameTargetParentNotExists() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameEmulationSourceNotExists() { @@ -177,7 +177,7 @@ public function testRenameEmulationSourceNotExists() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameEmulationTargetExists() { @@ -185,7 +185,7 @@ public function testRenameEmulationTargetExists() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testRenameEmulationTargetParentNotExists() { @@ -256,8 +256,8 @@ public function testRecursiveCopy() public function testSimpleLeafRenameWithDnObjects() { - $orgDn=LDAP\DN::fromString($this->_orgDn); - $newDn=LDAP\DN::fromString($this->_newDn); + $orgDn=Ldap\Dn::fromString($this->_orgDn); + $newDn=Ldap\Dn::fromString($this->_newDn); $this->_getLDAP()->rename($orgDn, $newDn, false); $this->assertFalse($this->_getLDAP()->exists($orgDn)); @@ -270,8 +270,8 @@ public function testSimpleLeafRenameWithDnObjects() public function testSimpleLeafMoveToSubtreeWithDnObjects() { - $orgDn=LDAP\DN::fromString($this->_orgDn); - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); + $orgDn=Ldap\Dn::fromString($this->_orgDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); $this->_getLDAP()->moveToSubtree($orgDn, $orgSubTreeDn, false); $this->assertFalse($this->_getLDAP()->exists($orgDn)); @@ -280,8 +280,8 @@ public function testSimpleLeafMoveToSubtreeWithDnObjects() public function testSimpleLeafRenameEmulationWithDnObjects() { - $orgDn=LDAP\DN::fromString($this->_orgDn); - $newDn=LDAP\DN::fromString($this->_newDn); + $orgDn=Ldap\Dn::fromString($this->_orgDn); + $newDn=Ldap\Dn::fromString($this->_newDn); $this->_getLDAP()->rename($orgDn, $newDn, false, true); $this->assertFalse($this->_getLDAP()->exists($orgDn)); @@ -290,8 +290,8 @@ public function testSimpleLeafRenameEmulationWithDnObjects() public function testSimpleLeafCopyToSubtreeWithDnObjects() { - $orgDn=LDAP\DN::fromString($this->_orgDn); - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); + $orgDn=Ldap\Dn::fromString($this->_orgDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); $this->_getLDAP()->copyToSubtree($orgDn, $orgSubTreeDn, false); $this->assertTrue($this->_getLDAP()->exists($orgDn)); @@ -300,8 +300,8 @@ public function testSimpleLeafCopyToSubtreeWithDnObjects() public function testSimpleLeafCopyWithDnObjects() { - $orgDn=LDAP\DN::fromString($this->_orgDn); - $newDn=LDAP\DN::fromString($this->_newDn); + $orgDn=Ldap\Dn::fromString($this->_orgDn); + $newDn=Ldap\Dn::fromString($this->_newDn); $this->_getLDAP()->copy($orgDn, $newDn, false); $this->assertTrue($this->_getLDAP()->exists($orgDn)); @@ -310,8 +310,8 @@ public function testSimpleLeafCopyWithDnObjects() public function testRecursiveRenameWithDnObjects() { - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); - $newSubTreeDn=LDAP\DN::fromString($this->_newSubTreeDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); + $newSubTreeDn=Ldap\Dn::fromString($this->_newSubTreeDn); $this->_getLDAP()->rename($orgSubTreeDn, $newSubTreeDn, true); $this->assertFalse($this->_getLDAP()->exists($orgSubTreeDn)); @@ -322,8 +322,8 @@ public function testRecursiveRenameWithDnObjects() public function testRecursiveMoveToSubtreeWithDnObjects() { - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); - $targetSubTreeDn=LDAP\DN::fromString($this->_targetSubTreeDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); + $targetSubTreeDn=Ldap\Dn::fromString($this->_targetSubTreeDn); $this->_getLDAP()->moveToSubtree($orgSubTreeDn, $targetSubTreeDn, true); $this->assertFalse($this->_getLDAP()->exists($orgSubTreeDn)); @@ -334,8 +334,8 @@ public function testRecursiveMoveToSubtreeWithDnObjects() public function testRecursiveCopyToSubtreeWithDnObjects() { - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); - $targetSubTreeDn=LDAP\DN::fromString($this->_targetSubTreeDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); + $targetSubTreeDn=Ldap\Dn::fromString($this->_targetSubTreeDn); $this->_getLDAP()->copyToSubtree($orgSubTreeDn, $targetSubTreeDn, true); $this->assertTrue($this->_getLDAP()->exists($orgSubTreeDn)); @@ -348,8 +348,8 @@ public function testRecursiveCopyToSubtreeWithDnObjects() public function testRecursiveCopyWithDnObjects() { - $orgSubTreeDn=LDAP\DN::fromString($this->_orgSubTreeDn); - $newSubTreeDn=LDAP\DN::fromString($this->_newSubTreeDn); + $orgSubTreeDn=Ldap\Dn::fromString($this->_orgSubTreeDn); + $newSubTreeDn=Ldap\Dn::fromString($this->_newSubTreeDn); $this->_getLDAP()->copy($orgSubTreeDn, $newSubTreeDn, true); $this->assertTrue($this->_getLDAP()->exists($orgSubTreeDn)); diff --git a/tests/Zend/LDAP/CrudTest.php b/tests/Zend/Ldap/CrudTest.php similarity index 93% rename from tests/Zend/LDAP/CrudTest.php rename to tests/Zend/Ldap/CrudTest.php index 54dabde4c8e..1736a0609f1 100644 --- a/tests/Zend/LDAP/CrudTest.php +++ b/tests/Zend/Ldap/CrudTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** * @category Zend @@ -48,7 +48,7 @@ public function testAddAndDelete() $this->assertEquals(1, $this->_getLDAP()->count('ou=TestCreated')); $this->_getLDAP()->delete($dn); $this->assertEquals(0, $this->_getLDAP()->count('ou=TestCreated')); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -73,7 +73,7 @@ public function testUpdate() $entry=$this->_getLDAP()->getEntry($dn); $this->_getLDAP()->delete($dn); $this->assertEquals('mylocation2', $entry['l'][0]); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -82,7 +82,7 @@ public function testUpdate() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testIllegalAdd() { @@ -111,19 +111,19 @@ public function testIllegalUpdate() try { $this->_getLDAP()->update($dn, $entry); } - catch (LDAP\Exception $e) { + catch (Ldap\Exception $e) { $exThrown=true; } $this->_getLDAP()->delete($dn); if (!$exThrown) $this->fail('no exception thrown while illegaly updating entry'); } - catch (LDAP\Exception $e) { + catch (Ldap\Exception $e) { $this->fail($e->getMessage()); } } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testIllegalDelete() { @@ -154,7 +154,7 @@ public function testDeleteRecursively() $exCaught=false; try { $this->_getLDAP()->delete($topDn, false); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $exCaught=true; } $this->assertTrue($exCaught, @@ -176,7 +176,7 @@ public function testSave() $entry=$this->_getLDAP()->getEntry($dn); $this->_getLDAP()->delete($dn); $this->assertEquals('mylocation1', $entry['l'][0]); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -197,7 +197,7 @@ public function testPrepareLDAPEntryArray() 'a7' => array(null), 'a8' => array(''), 'a9' => array('', null, 'account', '', null, 'TestCreated', '', null)); - LDAP\LDAP::prepareLDAPEntryArray($data); + Ldap\Ldap::prepareLDAPEntryArray($data); $expected=array( 'a1' => array('TestCreated'), 'a2' => array('account'), @@ -226,7 +226,7 @@ public function testZeroValueMakesItThroughSanitationProcess() 'nullArray' => array(null), 'emptyArray' => array(''), ); - LDAP\LDAP::prepareLDAPEntryArray($data); + Ldap\Ldap::prepareLDAPEntryArray($data); $expected=array( 'string' => array('0'), 'integer' => array('0'), @@ -247,7 +247,7 @@ public function testPrepareLDAPEntryArrayArrayData() { $data=array( 'a1' => array(array('account'))); - LDAP\LDAP::prepareLDAPEntryArray($data); + Ldap\Ldap::prepareLDAPEntryArray($data); } /** @@ -259,12 +259,12 @@ public function testPrepareLDAPEntryArrayObjectData() $class->a='b'; $data=array( 'a1' => array($class)); - LDAP\LDAP::prepareLDAPEntryArray($data); + Ldap\Ldap::prepareLDAPEntryArray($data); } public function testAddWithDnObject() { - $dn=LDAP\DN::fromString($this->_createDn('ou=TestCreated,')); + $dn=Ldap\Dn::fromString($this->_createDn('ou=TestCreated,')); $data=array( 'ou' => 'TestCreated', 'objectclass' => 'organizationalUnit' @@ -274,14 +274,14 @@ public function testAddWithDnObject() $this->assertEquals(1, $this->_getLDAP()->count('ou=TestCreated')); $this->_getLDAP()->delete($dn); } - catch (LDAP\Exception $e) { + catch (Ldap\Exception $e) { $this->fail($e->getMessage()); } } public function testUpdateWithDnObject() { - $dn=LDAP\DN::fromString($this->_createDn('ou=TestCreated,')); + $dn=Ldap\Dn::fromString($this->_createDn('ou=TestCreated,')); $data=array( 'ou' => 'TestCreated', 'l' => 'mylocation1', @@ -297,14 +297,14 @@ public function testUpdateWithDnObject() $this->_getLDAP()->delete($dn); $this->assertEquals('mylocation2', $entry['l'][0]); } - catch (LDAP\Exception $e) { + catch (Ldap\Exception $e) { $this->fail($e->getMessage()); } } public function testSaveWithDnObject() { - $dn=LDAP\DN::fromString($this->_createDn('ou=TestCreated,')); + $dn=Ldap\Dn::fromString($this->_createDn('ou=TestCreated,')); $data=array('ou' => 'TestCreated', 'objectclass' => 'organizationalUnit'); try { $this->_getLDAP()->save($dn, $data); @@ -315,7 +315,7 @@ public function testSaveWithDnObject() $entry=$this->_getLDAP()->getEntry($dn); $this->_getLDAP()->delete($dn); $this->assertEquals('mylocation1', $entry['l'][0]); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -343,7 +343,7 @@ public function testAddObjectClass() $this->assertEquals('domain', $entry['associateddomain'][0]); $this->assertContains('organizationalUnit', $entry['objectclass']); $this->assertContains('domainRelatedObject', $entry['objectclass']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -372,7 +372,7 @@ public function testRemoveObjectClass() $this->assertArrayNotHasKey('associateddomain', $entry); $this->assertContains('organizationalUnit', $entry['objectclass']); $this->assertNotContains('domainRelatedObject', $entry['objectclass']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLDAP()->exists($dn)) { $this->_getLDAP()->delete($dn); } @@ -395,7 +395,7 @@ public function testAddingEntryWithMissingRdnAttribute() $this->_getLdap()->delete($dn); $this->assertEquals(array('TestCreated'), $entry['ou']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLdap()->exists($dn)) { $this->_getLdap()->delete($dn); } @@ -419,7 +419,7 @@ public function testAddingEntryWithMissingRdnAttributeValue() $this->_getLdap()->delete($dn); $this->assertEquals(array('TestCreated', 'SecondOu'), $entry['ou']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLdap()->exists($dn)) { $this->_getLdap()->delete($dn); } @@ -443,7 +443,7 @@ public function testAddingEntryThatHasMultipleValuesOnRdnAttribute() $this->_getLdap()->delete($dn); $this->assertEquals(array('TestCreated', 'SecondOu'), $entry['ou']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLdap()->exists($dn)) { $this->_getLdap()->delete($dn); } @@ -471,7 +471,7 @@ public function testUpdatingEntryWithAttributeThatIsAnRdnAttribute() $this->_getLdap()->delete($dn); $this->assertEquals(array('TestCreated', 'SecondOu'), $entry['ou']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLdap()->exists($dn)) { $this->_getLdap()->delete($dn); } @@ -499,7 +499,7 @@ public function testUpdatingEntryWithRdnAttributeValueMissingInData() $this->_getLdap()->delete($dn); $this->assertEquals(array('TestCreated', 'SecondOu'), $entry['ou']); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { if ($this->_getLdap()->exists($dn)) { $this->_getLdap()->delete($dn); } diff --git a/tests/Zend/LDAP/DN/CreationTest.php b/tests/Zend/Ldap/Dn/CreationTest.php similarity index 68% rename from tests/Zend/LDAP/DN/CreationTest.php rename to tests/Zend/Ldap/Dn/CreationTest.php index f750c582f30..edf50e1df0e 100644 --- a/tests/Zend/LDAP/DN/CreationTest.php +++ b/tests/Zend/Ldap/Dn/CreationTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** * Test helper @@ -46,7 +46,7 @@ class CreationTest extends \PHPUnit_Framework_TestCase { public function testDnCreation() { - LDAP\DN::setDefaultCaseFold(LDAP\DN::ATTR_CASEFOLD_NONE); + Ldap\Dn::setDefaultCaseFold(Ldap\Dn::ATTR_CASEFOLD_NONE); $dnString1='CN=Baker\\, Alice,CN=Users+OU=Lab,DC=example,DC=com'; $dnArray1=array( @@ -69,117 +69,117 @@ public function testDnCreation() array('Dc' => 'example'), array('Dc' => 'com')); - $dn11=LDAP\DN::fromString($dnString1); - $dn12=LDAP\DN::fromArray($dnArray1); - $dn13=LDAP\DN::factory($dnString1); - $dn14=LDAP\DN::factory($dnArray1); + $dn11=Ldap\Dn::fromString($dnString1); + $dn12=Ldap\Dn::fromArray($dnArray1); + $dn13=Ldap\Dn::factory($dnString1); + $dn14=Ldap\Dn::factory($dnArray1); $this->assertEquals($dn11, $dn12); $this->assertEquals($dn11, $dn13); $this->assertEquals($dn11, $dn14); $this->assertEquals($dnString1, $dn11->toString()); - $this->assertEquals($dnString1, $dn11->toString(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnString2, $dn11->toString(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnString1, $dn11->toString(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnString2, $dn11->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER)); $this->assertEquals($dnArray1, $dn11->toArray()); - $this->assertEquals($dnArray1, $dn11->toArray(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnArray2, $dn11->toArray(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnArray1, $dn11->toArray(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnArray2, $dn11->toArray(Ldap\Dn::ATTR_CASEFOLD_LOWER)); - $dn21=LDAP\DN::fromString($dnString2); - $dn22=LDAP\DN::fromArray($dnArray2); - $dn23=LDAP\DN::factory($dnString2); - $dn24=LDAP\DN::factory($dnArray2); + $dn21=Ldap\Dn::fromString($dnString2); + $dn22=Ldap\Dn::fromArray($dnArray2); + $dn23=Ldap\Dn::factory($dnString2); + $dn24=Ldap\Dn::factory($dnArray2); $this->assertEquals($dn21, $dn22); $this->assertEquals($dn21, $dn23); $this->assertEquals($dn21, $dn24); $this->assertEquals($dnString2, $dn21->toString()); - $this->assertEquals($dnString1, $dn21->toString(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnString2, $dn21->toString(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnString1, $dn21->toString(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnString2, $dn21->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER)); $this->assertEquals($dnArray2, $dn21->toArray()); - $this->assertEquals($dnArray1, $dn21->toArray(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnArray2, $dn21->toArray(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnArray1, $dn21->toArray(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnArray2, $dn21->toArray(Ldap\Dn::ATTR_CASEFOLD_LOWER)); $this->assertEquals($dnArray2, $dn22->toArray()); - $dn31=LDAP\DN::fromString($dnString3); - $dn32=LDAP\DN::fromArray($dnArray3); - $dn33=LDAP\DN::factory($dnString3); - $dn34=LDAP\DN::factory($dnArray3); + $dn31=Ldap\Dn::fromString($dnString3); + $dn32=Ldap\Dn::fromArray($dnArray3); + $dn33=Ldap\Dn::factory($dnString3); + $dn34=Ldap\Dn::factory($dnArray3); $this->assertEquals($dn31, $dn32); $this->assertEquals($dn31, $dn33); $this->assertEquals($dn31, $dn34); $this->assertEquals($dnString3, $dn31->toString()); - $this->assertEquals($dnString1, $dn31->toString(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnString2, $dn31->toString(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnString1, $dn31->toString(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnString2, $dn31->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER)); $this->assertEquals($dnArray3, $dn31->toArray()); - $this->assertEquals($dnArray1, $dn31->toArray(LDAP\DN::ATTR_CASEFOLD_UPPER)); - $this->assertEquals($dnArray2, $dn31->toArray(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($dnArray1, $dn31->toArray(Ldap\Dn::ATTR_CASEFOLD_UPPER)); + $this->assertEquals($dnArray2, $dn31->toArray(Ldap\Dn::ATTR_CASEFOLD_LOWER)); try { - $dn=LDAP\DN::factory(1); + $dn=Ldap\Dn::factory(1); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Invalid argument type for $dn', $e->getMessage()); } } public function testDnCreationWithDifferentCaseFoldings() { - LDAP\DN::setDefaultCaseFold(LDAP\DN::ATTR_CASEFOLD_NONE); + Ldap\Dn::setDefaultCaseFold(Ldap\Dn::ATTR_CASEFOLD_NONE); $dnString1='Cn=Baker\\, Alice,Cn=Users+Ou=Lab,Dc=example,Dc=com'; $dnString2='CN=Baker\\, Alice,CN=Users+OU=Lab,DC=example,DC=com'; $dnString3='cn=Baker\\, Alice,cn=Users+ou=Lab,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString1, null); + $dn=Ldap\Dn::fromString($dnString1, null); $this->assertEquals($dnString1, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_UPPER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_UPPER); $this->assertEquals($dnString2, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dnString3, (string)$dn); - $dn=LDAP\DN::fromString($dnString1, LDAP\DN::ATTR_CASEFOLD_UPPER); + $dn=Ldap\Dn::fromString($dnString1, Ldap\Dn::ATTR_CASEFOLD_UPPER); $this->assertEquals($dnString2, (string)$dn); $dn->setCaseFold(null); $this->assertEquals($dnString1, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dnString3, (string)$dn); - $dn=LDAP\DN::fromString($dnString1, LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn=Ldap\Dn::fromString($dnString1, Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dnString3, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_UPPER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_UPPER); $this->assertEquals($dnString2, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dnString3, (string)$dn); - $dn->setCaseFold(LDAP\DN::ATTR_CASEFOLD_UPPER); + $dn->setCaseFold(Ldap\Dn::ATTR_CASEFOLD_UPPER); $this->assertEquals($dnString2, (string)$dn); - LDAP\DN::setDefaultCaseFold(LDAP\DN::ATTR_CASEFOLD_UPPER); - $dn=LDAP\DN::fromString($dnString1, null); + Ldap\Dn::setDefaultCaseFold(Ldap\Dn::ATTR_CASEFOLD_UPPER); + $dn=Ldap\Dn::fromString($dnString1, null); $this->assertEquals($dnString2, (string)$dn); - LDAP\DN::setDefaultCaseFold(null); - $dn=LDAP\DN::fromString($dnString1, null); + Ldap\Dn::setDefaultCaseFold(null); + $dn=Ldap\Dn::fromString($dnString1, null); $this->assertEquals($dnString1, (string)$dn); - LDAP\DN::setDefaultCaseFold(LDAP\DN::ATTR_CASEFOLD_NONE); + Ldap\Dn::setDefaultCaseFold(Ldap\Dn::ATTR_CASEFOLD_NONE); } public function testGetRdn() { - LDAP\DN::setDefaultCaseFold(LDAP\DN::ATTR_CASEFOLD_NONE); + Ldap\Dn::setDefaultCaseFold(Ldap\Dn::ATTR_CASEFOLD_NONE); $dnString='cn=Baker\\, Alice,cn=Users,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals(array('cn' => 'Baker, Alice'), $dn->getRdn()); $this->assertEquals('cn=Baker\\, Alice', $dn->getRdnString()); $dnString = 'Cn=Users+Ou=Lab,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals(array('Cn' => 'Users', 'Ou' => 'Lab'), $dn->getRdn()); $this->assertEquals('Cn=Users+Ou=Lab', $dn->getRdnString()); } @@ -187,7 +187,7 @@ public function testGetRdn() public function testGetParentDn() { $dnString='cn=Baker\\, Alice,cn=Users,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Users,dc=example,dc=com', $dn->getParentDn()->toString()); $this->assertEquals('cn=Users,dc=example,dc=com', $dn->getParentDn(1)->toString()); @@ -197,13 +197,13 @@ public function testGetParentDn() try { $dn->getParentDn(0)->toString(); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot retrieve parent DN with given $levelUp', $e->getMessage()); } try { $dn->getParentDn(4)->toString(); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot retrieve parent DN with given $levelUp', $e->getMessage()); } } @@ -211,7 +211,7 @@ public function testGetParentDn() public function testEmptyStringDn() { $dnString=''; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals($dnString, $dn->toString()); } diff --git a/tests/Zend/LDAP/DN/EscapingTest.php b/tests/Zend/Ldap/Dn/EscapingTest.php similarity index 80% rename from tests/Zend/LDAP/DN/EscapingTest.php rename to tests/Zend/Ldap/Dn/EscapingTest.php index 145a37a4711..04a3917b407 100644 --- a/tests/Zend/LDAP/DN/EscapingTest.php +++ b/tests/Zend/Ldap/Dn/EscapingTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** * Test helper @@ -48,19 +48,19 @@ public function testEscapeValues() { $dnval=' '.chr(22).' t,e+s"t,\\vl;u#e=! '; $expected='\20\20\16 t\,e\+s\"t\,\\\\v\l\;u\#e\=!\20\20\20\20'; - $this->assertEquals($expected, LDAP\DN::escapeValue($dnval)); - $this->assertEquals($expected, LDAP\DN::escapeValue(array($dnval))); + $this->assertEquals($expected, Ldap\Dn::escapeValue($dnval)); + $this->assertEquals($expected, Ldap\Dn::escapeValue(array($dnval))); $this->assertEquals(array($expected, $expected, $expected), - LDAP\DN::escapeValue(array($dnval, $dnval, $dnval))); + Ldap\Dn::escapeValue(array($dnval, $dnval, $dnval))); } public function testUnescapeValues() { $dnval='\\20\\20\\16\\20t\\,e\\+s \\"t\\,\\\\v\\l\\;u\\#e\\=!\\20\\20\\20\\20'; $expected=' '.chr(22).' t,e+s "t,\\vl;u#e=! '; - $this->assertEquals($expected, LDAP\DN::unescapeValue($dnval)); - $this->assertEquals($expected, LDAP\DN::unescapeValue(array($dnval))); + $this->assertEquals($expected, Ldap\Dn::unescapeValue($dnval)); + $this->assertEquals($expected, Ldap\Dn::unescapeValue(array($dnval))); $this->assertEquals(array($expected, $expected, $expected), - LDAP\DN::unescapeValue(array($dnval,$dnval,$dnval))); + Ldap\Dn::unescapeValue(array($dnval,$dnval,$dnval))); } } diff --git a/tests/Zend/LDAP/DN/ExplodingTest.php b/tests/Zend/Ldap/Dn/ExplodingTest.php similarity index 91% rename from tests/Zend/LDAP/DN/ExplodingTest.php rename to tests/Zend/Ldap/Dn/ExplodingTest.php index ebfa6efa959..2e43b6429be 100644 --- a/tests/Zend/LDAP/DN/ExplodingTest.php +++ b/tests/Zend/Ldap/Dn/ExplodingTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** @@ -79,7 +79,7 @@ public static function explodeDnOperationProvider() */ public function testExplodeDnOperation($input, $expected) { - $ret = LDAP\DN::checkDn($input); + $ret = Ldap\Dn::checkDn($input); $this->assertTrue($ret === $expected); } @@ -88,13 +88,13 @@ public function testExplodeDnCaseFold() $dn='CN=Alice Baker,cn=Users,DC=example,dc=com'; $k=array(); $v=null; - $this->assertTrue(LDAP\DN::checkDn($dn, $k, $v, LDAP\DN::ATTR_CASEFOLD_NONE)); + $this->assertTrue(Ldap\Dn::checkDn($dn, $k, $v, Ldap\Dn::ATTR_CASEFOLD_NONE)); $this->assertEquals(array('CN', 'cn', 'DC', 'dc'), $k); - $this->assertTrue(LDAP\DN::checkDn($dn, $k, $v, LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertTrue(Ldap\Dn::checkDn($dn, $k, $v, Ldap\Dn::ATTR_CASEFOLD_LOWER)); $this->assertEquals(array('cn', 'cn', 'dc', 'dc'), $k); - $this->assertTrue(LDAP\DN::checkDn($dn, $k, $v, LDAP\DN::ATTR_CASEFOLD_UPPER)); + $this->assertTrue(Ldap\Dn::checkDn($dn, $k, $v, Ldap\Dn::ATTR_CASEFOLD_UPPER)); $this->assertEquals(array('CN', 'CN', 'DC', 'DC'), $k); } @@ -103,7 +103,7 @@ public function testExplodeDn() $dn='cn=name1,cn=name2,dc=example,dc=org'; $k=array(); $v=array(); - $dnArray=LDAP\DN::explodeDn($dn, $k, $v); + $dnArray=Ldap\Dn::explodeDn($dn, $k, $v); $expected=array( array("cn" => "name1"), array("cn" => "name2"), @@ -122,7 +122,7 @@ public function testExplodeDnWithUtf8Characters() $dn='uid=rogasawara,ou=営業部,o=Airius'; $k=array(); $v=array(); - $dnArray=LDAP\DN::explodeDn($dn, $k, $v); + $dnArray=Ldap\Dn::explodeDn($dn, $k, $v); $expected=array( array("uid" => "rogasawara"), array("ou" => "営業部"), @@ -140,7 +140,7 @@ public function testExplodeDnWithSpaces() $dn='cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com'; $k=array(); $v=array(); - $dnArray=LDAP\DN::explodeDn($dn, $k, $v); + $dnArray=Ldap\Dn::explodeDn($dn, $k, $v); $expected=array( array("cn" => "Barbara Jensen"), array("ou" => "Product Development"), @@ -159,17 +159,17 @@ public function testCoreExplodeDnWithMultiValuedRdn() $dn='cn=name1+uid=user,cn=name2,dc=example,dc=org'; $k=array(); $v=array(); - $this->assertTrue(LDAP\DN::checkDn($dn, $k, $v)); + $this->assertTrue(Ldap\Dn::checkDn($dn, $k, $v)); $ke=array(array('cn', 'uid'), 'cn', 'dc', 'dc'); $ve=array(array('name1', 'user'), 'name2', 'example', 'org'); $this->assertEquals($ke, $k); $this->assertEquals($ve, $v); $dn='cn=name11+cn=name12,cn=name2,dc=example,dc=org'; - $this->assertFalse(LDAP\DN::checkDn($dn)); + $this->assertFalse(Ldap\Dn::checkDn($dn)); $dn='CN=name11+Cn=name12,cn=name2,dc=example,dc=org'; - $this->assertFalse(LDAP\DN::checkDn($dn)); + $this->assertFalse(Ldap\Dn::checkDn($dn)); } public function testExplodeDnWithMultiValuedRdn() @@ -177,7 +177,7 @@ public function testExplodeDnWithMultiValuedRdn() $dn='cn=Surname\, Firstname+uid=userid,cn=name2,dc=example,dc=org'; $k=array(); $v=array(); - $dnArray=LDAP\DN::explodeDn($dn, $k, $v); + $dnArray=Ldap\Dn::explodeDn($dn, $k, $v); $ke=array(array('cn', 'uid'), 'cn', 'dc', 'dc'); $ve=array(array('Surname, Firstname', 'userid'), 'name2', 'example', 'org'); $this->assertEquals($ke, $k); @@ -196,7 +196,7 @@ public function testExplodeDnWithMultiValuedRdn2() $dn='cn=Surname\, Firstname+uid=userid+sn=Surname,cn=name2,dc=example,dc=org'; $k=array(); $v=array(); - $dnArray=LDAP\DN::explodeDn($dn, $k, $v); + $dnArray=Ldap\Dn::explodeDn($dn, $k, $v); $ke=array(array('cn', 'uid', 'sn'), 'cn', 'dc', 'dc'); $ve=array(array('Surname, Firstname', 'userid', 'Surname'), 'name2', 'example', 'org'); $this->assertEquals($ke, $k); @@ -211,12 +211,12 @@ public function testExplodeDnWithMultiValuedRdn2() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testCreateDnArrayIllegalDn() { $dn='name1,cn=name2,dc=example,dc=org'; - $dnArray=LDAP\DN::explodeDn($dn); + $dnArray=Ldap\Dn::explodeDn($dn); } public static function rfc2253DnProvider() @@ -259,7 +259,7 @@ public static function rfc2253DnProvider() */ public function testExplodeDnsProvidedByRFC2253($input, $expected) { - $dnArray=LDAP\DN::explodeDn($input); + $dnArray=Ldap\Dn::explodeDn($input); $this->assertEquals($expected, $dnArray); } } diff --git a/tests/Zend/LDAP/DN/ImplodingTest.php b/tests/Zend/Ldap/Dn/ImplodingTest.php similarity index 79% rename from tests/Zend/LDAP/DN/ImplodingTest.php rename to tests/Zend/Ldap/Dn/ImplodingTest.php index e343b9a43ce..48c74c1ea5b 100644 --- a/tests/Zend/LDAP/DN/ImplodingTest.php +++ b/tests/Zend/Ldap/Dn/ImplodingTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** * @category Zend @@ -40,8 +40,8 @@ class ImplodingTest extends \PHPUnit_Framework_TestCase 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); + $dnArray=Ldap\Dn::explodeDn($dn1); + $dn2=Ldap\Dn::implodeDn($dnArray); $this->assertEquals($dn1, $dn2); } @@ -54,10 +54,10 @@ public function testImplodeDn() array("dc" => "example"), array("dc" => "org") ); - $dn=LDAP\DN::implodeDn($dnArray); + $dn=Ldap\Dn::implodeDn($dnArray); $this->assertEquals($expected, $dn); - $dn=LDAP\DN::implodeDn($dnArray, LDAP\DN::ATTR_CASEFOLD_UPPER, ';'); + $dn=Ldap\Dn::implodeDn($dnArray, Ldap\Dn::ATTR_CASEFOLD_UPPER, ';'); $this->assertEquals('CN=name1;CN=name2;DC=example;DC=org', $dn); } @@ -69,7 +69,7 @@ public function testImplodeDnWithUtf8Characters() array("ou" => "営業部"), array("o" => "Airius"), ); - $dn=LDAP\DN::implodeDn($dnArray); + $dn=Ldap\Dn::implodeDn($dnArray); $this->assertEquals($expected, $dn); } @@ -77,21 +77,21 @@ public function testImplodeRdn() { $a=array('cn' => 'value'); $expected='cn=value'; - $this->assertEquals($expected, LDAP\DN::implodeRdn($a)); + $this->assertEquals($expected, Ldap\Dn::implodeRdn($a)); } public function testImplodeRdnMultiValuedRdn() { $a=array('cn' => 'value', 'uid' => 'testUser'); $expected='cn=value+uid=testUser'; - $this->assertEquals($expected, LDAP\DN::implodeRdn($a)); + $this->assertEquals($expected, Ldap\Dn::implodeRdn($a)); } public function testImplodeRdnMultiValuedRdn2() { $a=array('cn' => 'value', 'uid' => 'testUser', 'ou' => 'myDep'); $expected='cn=value+ou=myDep+uid=testUser'; - $this->assertEquals($expected, LDAP\DN::implodeRdn($a)); + $this->assertEquals($expected, Ldap\Dn::implodeRdn($a)); } public function testImplodeRdnCaseFold() @@ -99,11 +99,11 @@ public function testImplodeRdnCaseFold() $a=array('cn' => 'value'); $expected='CN=value'; $this->assertEquals($expected, - LDAP\DN::implodeRdn($a, LDAP\DN::ATTR_CASEFOLD_UPPER)); + Ldap\Dn::implodeRdn($a, Ldap\Dn::ATTR_CASEFOLD_UPPER)); $a=array('CN' => 'value'); $expected='cn=value'; $this->assertEquals($expected, - LDAP\DN::implodeRdn($a, LDAP\DN::ATTR_CASEFOLD_LOWER)); + Ldap\Dn::implodeRdn($a, Ldap\Dn::ATTR_CASEFOLD_LOWER)); } public function testImplodeRdnMultiValuedRdnCaseFold() @@ -111,28 +111,28 @@ public function testImplodeRdnMultiValuedRdnCaseFold() $a=array('cn' => 'value', 'uid' => 'testUser', 'ou' => 'myDep'); $expected='CN=value+OU=myDep+UID=testUser'; $this->assertEquals($expected, - LDAP\DN::implodeRdn($a, LDAP\DN::ATTR_CASEFOLD_UPPER)); + Ldap\Dn::implodeRdn($a, Ldap\Dn::ATTR_CASEFOLD_UPPER)); $a=array('CN' => 'value', 'uID' => 'testUser', 'ou' => 'myDep'); $expected='cn=value+ou=myDep+uid=testUser'; $this->assertEquals($expected, - LDAP\DN::implodeRdn($a, LDAP\DN::ATTR_CASEFOLD_LOWER)); + Ldap\Dn::implodeRdn($a, Ldap\Dn::ATTR_CASEFOLD_LOWER)); } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testImplodeRdnInvalidOne() { $a=array('cn'); - LDAP\DN::implodeRdn($a); + Ldap\Dn::implodeRdn($a); } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testImplodeRdnInvalidThree() { $a=array('cn' => 'value', 'ou'); - LDAP\DN::implodeRdn($a); + Ldap\Dn::implodeRdn($a); } } diff --git a/tests/Zend/LDAP/DN/MiscTest.php b/tests/Zend/Ldap/Dn/MiscTest.php similarity index 78% rename from tests/Zend/LDAP/DN/MiscTest.php rename to tests/Zend/Ldap/Dn/MiscTest.php index 97fb083ee1b..031bb27eaf9 100644 --- a/tests/Zend/LDAP/DN/MiscTest.php +++ b/tests/Zend/Ldap/Dn/MiscTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** * Test helper @@ -48,48 +48,48 @@ public function testIsChildOfIllegalDn1() { $dn1='name1,cn=name2,dc=example,dc=org'; $dn2='dc=example,dc=org'; - $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertFalse(Ldap\Dn::isChildOf($dn1, $dn2)); } public function testIsChildOfIllegalDn2() { $dn1='cn=name1,cn=name2,dc=example,dc=org'; $dn2='example,dc=org'; - $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertFalse(Ldap\Dn::isChildOf($dn1, $dn2)); } public function testIsChildOfIllegalBothDn() { $dn1='name1,cn=name2,dc=example,dc=org'; $dn2='example,dc=org'; - $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertFalse(Ldap\Dn::isChildOf($dn1, $dn2)); } public function testIsChildOf() { $dn1='cb=name1,cn=name2,dc=example,dc=org'; $dn2='dc=example,dc=org'; - $this->assertTrue(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertTrue(Ldap\Dn::isChildOf($dn1, $dn2)); } 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)); + $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)); } public function testIsChildOfOtherSubtree() { $dn1='cb=name1,cn=name2,dc=example,dc=org'; $dn2='dc=example,dc=de'; - $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertFalse(Ldap\Dn::isChildOf($dn1, $dn2)); } public function testIsChildOfParentDnLonger() { $dn1='dc=example,dc=de'; $dn2='cb=name1,cn=name2,dc=example,dc=org'; - $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2)); + $this->assertFalse(Ldap\Dn::isChildOf($dn1, $dn2)); } } diff --git a/tests/Zend/LDAP/DN/ModificationTest.php b/tests/Zend/Ldap/Dn/ModificationTest.php similarity index 86% rename from tests/Zend/LDAP/DN/ModificationTest.php rename to tests/Zend/Ldap/Dn/ModificationTest.php index 4778a4aa59c..614d8f38770 100644 --- a/tests/Zend/LDAP/DN/ModificationTest.php +++ b/tests/Zend/Ldap/Dn/ModificationTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Dn; -use Zend\LDAP; +namespace ZendTest\Ldap\Dn; +use Zend\Ldap; /** * Test helper @@ -47,7 +47,7 @@ class ModificationTest extends \PHPUnit_Framework_TestCase public function testDnManipulationGet() { $dnString='cn=Baker\\, Alice,cn=Users+ou=Lab,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals(array('cn' => 'Baker, Alice'), $dn->get(0)); $this->assertEquals(array('cn' => 'Users', 'ou' => 'Lab'), $dn->get(1)); @@ -56,19 +56,19 @@ public function testDnManipulationGet() try { $this->assertEquals(array('dc' => 'com'), $dn->get('string')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index must be an integer', $e->getMessage()); } try { $this->assertEquals(array('cn' => 'Baker, Alice'), $dn->get(-1)); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index out of bounds', $e->getMessage()); } try { $this->assertEquals(array('dc' => 'com'), $dn->get(4)); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index out of bounds', $e->getMessage()); } @@ -126,7 +126,7 @@ public function testDnManipulationGet() public function testDnManipulationSet() { $dnString='cn=Baker\\, Alice,cn=Users+ou=Lab,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('uid=abaker,cn=Users+ou=Lab,dc=example,dc=com', $dn->set(0, array('uid' => 'abaker'))->toString()); @@ -140,13 +140,13 @@ public function testDnManipulationSet() try { $dn->set(4, array('dc' => 'de')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index out of bounds', $e->getMessage()); } try { $dn->set(3, array('dc' => 'de', 'ou')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('RDN Array is malformed: it must use string keys', $e->getMessage()); } } @@ -155,36 +155,36 @@ public function testDnManipulationRemove() { $dnString='cn=Baker\\, Alice,cn=Users+ou=Lab,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Users+ou=Lab,dc=example,dc=com', $dn->remove(0)->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,dc=example,dc=com', $dn->remove(1)->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,cn=Users+ou=Lab,dc=com', $dn->remove(2)->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,cn=Users+ou=Lab,dc=example', $dn->remove(3)->toString()); try { - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $dn->remove(4); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index out of bounds', $e->getMessage()); } - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,dc=com', $dn->remove(1, 2)->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice', $dn->remove(1, 3)->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice', $dn->remove(1, 4)->toString()); } @@ -192,7 +192,7 @@ public function testDnManipulationRemove() public function testDnManipulationAppendAndPrepend() { $dnString='OU=Sales,DC=example'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('OU=Sales,DC=example,DC=com', $dn->append(array('DC' => 'com'))->toString()); @@ -203,13 +203,13 @@ public function testDnManipulationAppendAndPrepend() try { $dn->append(array('dc' => 'de', 'ou')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('RDN Array is malformed: it must use string keys', $e->getMessage()); } try { $dn->prepend(array('dc' => 'de', 'ou')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('RDN Array is malformed: it must use string keys', $e->getMessage()); } } @@ -218,34 +218,34 @@ public function testDnManipulationInsert() { $dnString='cn=Baker\\, Alice,cn=Users,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,dc=test,cn=Users,dc=example,dc=com', $dn->insert(0, array('dc' => 'test'))->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=test,dc=example,dc=com', $dn->insert(1, array('dc' => 'test'))->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example,dc=test,dc=com', $dn->insert(2, array('dc' => 'test'))->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example,dc=com,dc=test', $dn->insert(3, array('dc' => 'test'))->toString()); try { - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $dn->insert(4, array('dc' => 'de')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Parameter $index out of bounds', $e->getMessage()); } try { - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $dn->insert(3, array('dc' => 'de', 'ou')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('RDN Array is malformed: it must use string keys', $e->getMessage()); } } @@ -253,7 +253,7 @@ public function testDnManipulationInsert() public function testArrayAccessImplementation() { $dnString='cn=Baker\\, Alice,cn=Users,dc=example,dc=com'; - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); $this->assertEquals(array('cn' => 'Baker, Alice'), $dn[0]); $this->assertEquals(array('cn' => 'Users'), $dn[1]); @@ -267,35 +267,35 @@ public function testArrayAccessImplementation() $this->assertFalse(isset($dn[-1])); $this->assertFalse(isset($dn[4])); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); unset($dn[0]); $this->assertEquals('cn=Users,dc=example,dc=com', $dn->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); unset($dn[1]); $this->assertEquals('cn=Baker\\, Alice,dc=example,dc=com', $dn->toString()); - $dn=LDAP\DN::fromString($dnString); + $dn=Ldap\Dn::fromString($dnString); unset($dn[2]); $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=com', $dn->toString()); - $dn=LDAP\DN::fromString($dnString); + $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=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=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=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=Ldap\Dn::fromString($dnString); $dn[3]=array('dc' => 'de+fr'); $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example,dc=de\+fr', $dn->toString()); } diff --git a/tests/Zend/LDAP/FilterTest.php b/tests/Zend/Ldap/FilterTest.php similarity index 98% rename from tests/Zend/LDAP/FilterTest.php rename to tests/Zend/Ldap/FilterTest.php index 91c5f7ac66c..765cf95fca1 100644 --- a/tests/Zend/LDAP/FilterTest.php +++ b/tests/Zend/Ldap/FilterTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP\Filter; +namespace ZendTest\Ldap; +use Zend\Ldap\Filter; /** * @category Zend @@ -116,7 +116,7 @@ public function testNegate() } /** - * @expectedException Zend\LDAP\Filter\Exception + * @expectedException Zend\Ldap\Filter\Exception */ public function testIllegalGroupingFilter() { diff --git a/tests/Zend/LDAP/LDIF/SimpleDecoderTest.php b/tests/Zend/Ldap/Ldif/SimpleDecoderTest.php similarity index 96% rename from tests/Zend/LDAP/LDIF/SimpleDecoderTest.php rename to tests/Zend/Ldap/Ldif/SimpleDecoderTest.php index 32dd5190818..8e29ac86297 100644 --- a/tests/Zend/LDAP/LDIF/SimpleDecoderTest.php +++ b/tests/Zend/Ldap/Ldif/SimpleDecoderTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\LDIF; -use Zend\LDAP\LDIF; +namespace ZendTest\Ldap\Ldif; +use Zend\Ldap\Ldif; /** @@ -36,7 +36,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Ldif */ -class SimpleDecoderTest extends \ZendTest\LDAP\TestCase +class SimpleDecoderTest extends \ZendTest\Ldap\TestCase { public function testDecodeSimpleSingleItem() { @@ -49,7 +49,7 @@ public function testDecodeSimpleSingleItem() 'dn' => 'cn=test3,ou=example,dc=cno', 'objectclass' => array('oc1'), 'attr3' => array('foo')); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -78,7 +78,7 @@ public function testDecodeSingleItemWithFoldedAttribute() 'h6ttttttttt3489t57nhvgh4788trhg8999vnhtgthgui65hgb' . '5789thvngwr789cghm738'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -108,7 +108,7 @@ public function testDecodeSingleItemWithBase64Attributes() 'attr6' => array(':badinitchar', ' array('test öäü'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -130,7 +130,7 @@ public function testDecodeSingleItemWithFoldedBase64Attribute() 'attr2' => array('1234', 'baz'), 'attr3' => array('foo', 'bar'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -175,7 +175,7 @@ public function testDecodeTwoItems() 'telephonenumber' => array('+1 408 555 1212'), ), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -207,7 +207,7 @@ public function testDecodeStringContainingEntryWithFoldedAttributeValue() ' in search of perfect sailing conditions.'), 'title' => array('Product Manager, Rod and Reel Division'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -240,7 +240,7 @@ public function testDecodeStringContainingBase64EncodedValue() 'control character in it (a CR).' . "\r" . ' By the way, you should really get out more.'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -301,7 +301,7 @@ public function testDecodeStringContainingEntriesWithUtf8EncodedAttributeValues( cn;lang-en: Rodney Ogasawara title;lang-en: Sales, Director"; - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals('ou=営業部,o=Airius', $actual[0]['dn']); $this->assertEquals(array('top', 'organizationalUnit'), $actual[0]['objectclass']); @@ -373,7 +373,7 @@ public function testDecodeSingleItemWithFoldedAttributesAndEmptyLinesBetween() 'h6ttttttttt3489t57nhvgh4788trhg8999vnhtgthgui65hgb' . '5789thvngwr789cghm738'), ); - $actual = LDIF\Encoder::decode($data); + $actual = Ldif\Encoder::decode($data); $this->assertEquals($expected, $actual); } @@ -381,7 +381,7 @@ public function testRoundtripEncoding() { $node = $this->_createTestNode(); $ldif = $node->toLdif(); - $data = LDIF\Encoder::decode($ldif); + $data = Ldif\Encoder::decode($ldif); $expected = array_merge(array('dn' => $node->getDnString()), $node->getData(false)); $this->assertEquals($expected, $data); } diff --git a/tests/Zend/LDAP/LDIF/SimpleEncoderTest.php b/tests/Zend/Ldap/Ldif/SimpleEncoderTest.php similarity index 94% rename from tests/Zend/LDAP/LDIF/SimpleEncoderTest.php rename to tests/Zend/Ldap/Ldif/SimpleEncoderTest.php index 2cbfe5ffb8d..94efb4fcbad 100644 --- a/tests/Zend/LDAP/LDIF/SimpleEncoderTest.php +++ b/tests/Zend/Ldap/Ldif/SimpleEncoderTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Ldif; -use Zend\LDAP\LDIF; +namespace ZendTest\Ldap\Ldif; +use Zend\Ldap\Ldif; /** @@ -36,7 +36,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Ldif */ -class SimpleEncoderTest extends \ZendTest\LDAP\TestCase +class SimpleEncoderTest extends \ZendTest\Ldap\TestCase { public static function stringEncodingProvider() { @@ -68,7 +68,7 @@ public static function stringEncodingProvider() */ public function testStringEncoding($string, $expected) { - $this->assertEquals($expected, LDIF\Encoder::encode($string)); + $this->assertEquals($expected, Ldif\Encoder::encode($string)); } public static function attributeEncodingProvider() @@ -93,7 +93,7 @@ public static function attributeEncodingProvider() */ public function testAttributeEncoding($array, $expected) { - $actual = LDIF\Encoder::encode($array); + $actual = Ldif\Encoder::encode($array); $this->assertEquals($expected, $actual); } @@ -101,7 +101,7 @@ public function testChangedWrapCount() { $input = '56789012345678901234567890'; $expected = 'dn: 567890' . PHP_EOL . ' 1234567890' . PHP_EOL . ' 1234567890'; - $output = LDIF\Encoder::encode(array('dn' => $input), array('wrap' => 10)); + $output = Ldif\Encoder::encode(array('dn' => $input), array('wrap' => 10)); $this->assertEquals($expected, $output); } @@ -119,13 +119,13 @@ public function testEncodeMultipleAttributes() 'c: ' . PHP_EOL . 'd: ' . PHP_EOL . 'e: '; - $actual = LDIF\Encoder::encode($data); + $actual = Ldif\Encoder::encode($data); $this->assertEquals($expected, $actual); } public function testEncodeUnsupportedType() { - $this->assertNull(LDIF\Encoder::encode(new \stdClass())); + $this->assertNull(Ldif\Encoder::encode(new \stdClass())); } public function testSorting() @@ -149,7 +149,7 @@ public function testSorting() 'host: a' . PHP_EOL . 'host: b' . PHP_EOL . 'host: c'; - $actual = LDIF\Encoder::encode($data); + $actual = Ldif\Encoder::encode($data); $this->assertEquals($expected, $actual); $expected = 'version: 1' . PHP_EOL . @@ -163,7 +163,7 @@ public function testSorting() 'boolean: FALSE' . PHP_EOL . 'objectclass: account' . PHP_EOL . 'objectclass: top'; - $actual = LDIF\Encoder::encode($data, array('sort' => false)); + $actual = Ldif\Encoder::encode($data, array('sort' => false)); $this->assertEquals($expected, $actual); } @@ -184,7 +184,7 @@ public function testNodeEncoding() $actual = $node->toLdif(); $this->assertEquals($expected, $actual); - $actual = LDIF\Encoder::encode($node); + $actual = Ldif\Encoder::encode($node); $this->assertEquals($expected, $actual); } @@ -208,7 +208,7 @@ public function testSupressVersionHeader() 'host: a' . PHP_EOL . 'host: b' . PHP_EOL . 'host: c'; - $actual = LDIF\Encoder::encode($data, array('version' => null)); + $actual = Ldif\Encoder::encode($data, array('version' => null)); $this->assertEquals($expected, $actual); } @@ -261,7 +261,7 @@ public function testEncodingWithJapaneseCharacters() 'sn;lang-en: Ogasawara' . PHP_EOL . 'cn;lang-en: Rodney Ogasawara' . PHP_EOL . 'title;lang-en: Sales, Director'; - $actual = LDIF\Encoder::encode($data, array('sort' => false, 'version' => null)); + $actual = Ldif\Encoder::encode($data, array('sort' => false, 'version' => null)); $this->assertEquals($expected, $actual); } } diff --git a/tests/Zend/LDAP/Node/AttributeIterationTest.php b/tests/Zend/Ldap/Node/AttributeIterationTest.php similarity index 95% rename from tests/Zend/LDAP/Node/AttributeIterationTest.php rename to tests/Zend/Ldap/Node/AttributeIterationTest.php index 5e92ba5e351..e09e3909981 100644 --- a/tests/Zend/LDAP/Node/AttributeIterationTest.php +++ b/tests/Zend/Ldap/Node/AttributeIterationTest.php @@ -23,7 +23,7 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; +namespace ZendTest\Ldap\Node; /** @@ -35,7 +35,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class AttributeIterationTest extends \ZendTest\LDAP\TestCase +class AttributeIterationTest extends \ZendTest\Ldap\TestCase { public function testSimpleIteration() { diff --git a/tests/Zend/LDAP/Node/ChildrenIterationTest.php b/tests/Zend/Ldap/Node/ChildrenIterationTest.php similarity index 84% rename from tests/Zend/LDAP/Node/ChildrenIterationTest.php rename to tests/Zend/Ldap/Node/ChildrenIterationTest.php index 2b48bae0182..a4b268ad659 100644 --- a/tests/Zend/LDAP/Node/ChildrenIterationTest.php +++ b/tests/Zend/Ldap/Node/ChildrenIterationTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP; +namespace ZendTest\Ldap\Node; +use Zend\Ldap; /** * Zend_LDAP_OnlineTestCase @@ -42,7 +42,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class ChildrenIterationTest extends \ZendTest\LDAP\OnlineTestCase +class ChildrenIterationTest extends \ZendTest\Ldap\OnlineTestCase { protected function setUp() { @@ -63,8 +63,8 @@ public function testSimpleIteration() $i=1; foreach ($children as $rdn => $n) { - $dn=$n->getDn()->toString(LDAP\DN::ATTR_CASEFOLD_LOWER); - $rdn=LDAP\DN::implodeRdn($n->getRdnArray(), LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn=$n->getDn()->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER); + $rdn=Ldap\Dn::implodeRdn($n->getRdnArray(), Ldap\Dn::ATTR_CASEFOLD_LOWER); if ($i==1) { $this->assertEquals('ou=Node', $rdn); $this->assertEquals($this->_createDn('ou=Node,'), $dn); @@ -84,11 +84,11 @@ public function testSimpleRecursiveIteration() $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); + $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); + $this->assertEquals(Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE) + ->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER), $dn); } else if ($i==1) { $this->assertEquals('ou=Node', $rdn); @@ -101,8 +101,8 @@ public function testSimpleRecursiveIteration() } else { $j=$i-3; - $base=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE) - ->toString(LDAP\DN::ATTR_CASEFOLD_LOWER); + $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); diff --git a/tests/Zend/LDAP/Node/ChildrenTest.php b/tests/Zend/Ldap/Node/ChildrenTest.php similarity index 94% rename from tests/Zend/LDAP/Node/ChildrenTest.php rename to tests/Zend/Ldap/Node/ChildrenTest.php index 352e929cc0e..e25d2f47222 100644 --- a/tests/Zend/LDAP/Node/ChildrenTest.php +++ b/tests/Zend/Ldap/Node/ChildrenTest.php @@ -23,7 +23,7 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; +namespace ZendTest\Ldap\Node; /** @@ -35,7 +35,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class ChildrenTest extends \ZendTest\LDAP\OnlineTestCase +class ChildrenTest extends \ZendTest\Ldap\OnlineTestCase { protected function setUp() { @@ -53,9 +53,9 @@ public function testGetChildrenOnAttachedNode() { $node=$this->_getLDAP()->getBaseNode(); $children=$node->getChildren(); - $this->assertType('Zend\LDAP\Node\ChildrenIterator', $children); + $this->assertType('Zend\Ldap\Node\ChildrenIterator', $children); $this->assertEquals(6, count($children)); - $this->assertType('Zend\LDAP\Node', $children['ou=Node']); + $this->assertType('Zend\Ldap\Node', $children['ou=Node']); } public function testGetChildrenOnDetachedNode() @@ -63,16 +63,16 @@ public function testGetChildrenOnDetachedNode() $node=$this->_getLDAP()->getBaseNode(); $node->detachLDAP(); $children=$node->getChildren(); - $this->assertType('Zend\LDAP\Node\ChildrenIterator', $children); + $this->assertType('Zend\Ldap\Node\ChildrenIterator', $children); $this->assertEquals(0, count($children)); $node->attachLDAP($this->_getLDAP()); $node->reload(); $children=$node->getChildren(); - $this->assertType('Zend\LDAP\Node\ChildrenIterator', $children); + $this->assertType('Zend\Ldap\Node\ChildrenIterator', $children); $this->assertEquals(6, count($children)); - $this->assertType('Zend\LDAP\Node', $children['ou=Node']); + $this->assertType('Zend\Ldap\Node', $children['ou=Node']); } public function testHasChildrenOnAttachedNode() diff --git a/tests/Zend/LDAP/Node/OfflineTest.php b/tests/Zend/Ldap/Node/OfflineTest.php similarity index 95% rename from tests/Zend/LDAP/Node/OfflineTest.php rename to tests/Zend/Ldap/Node/OfflineTest.php index ca183dab3a0..fc79f694ffd 100644 --- a/tests/Zend/LDAP/Node/OfflineTest.php +++ b/tests/Zend/Ldap/Node/OfflineTest.php @@ -23,9 +23,9 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP\Node; -use Zend\LDAP; +namespace ZendTest\Ldap\Node; +use Zend\Ldap\Node; +use Zend\Ldap; /** * @category Zend @@ -36,7 +36,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class OfflineTest extends \ZendTest\LDAP\TestCase +class OfflineTest extends \ZendTest\Ldap\TestCase { protected function _assertLocalDateTimeString($timestamp, $value) { @@ -54,7 +54,7 @@ public function testCreateFromArrayStringDn() { $data=$this->_createTestArrayData(); $node=Node::fromArray($data); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertFalse($node->isAttached()); $this->assertFalse($node->willBeDeleted()); $this->assertFalse($node->willBeMoved()); @@ -64,14 +64,14 @@ public function testCreateFromArrayStringDn() public function testCreateFromArrayObjectDn() { $data=$this->_createTestArrayData(); - $data['dn']=LDAP\DN::fromString($data['dn']); + $data['dn']=Ldap\Dn::fromString($data['dn']); $node=Node::fromArray($data); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertFalse($node->isAttached()); } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testCreateFromArrayMissingDn() { @@ -81,7 +81,7 @@ public function testCreateFromArrayMissingDn() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testCreateFromArrayIllegalDn() { @@ -91,7 +91,7 @@ public function testCreateFromArrayIllegalDn() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testCreateFromArrayMalformedDn() { @@ -103,9 +103,9 @@ public function testCreateFromArrayMalformedDn() public function testCreateFromArrayAndEnsureRdnValues() { $data=$this->_createTestArrayData(); - $data['dn']=LDAP\DN::fromString($data['dn']); + $data['dn']=Ldap\Dn::fromString($data['dn']); $node=Node::fromArray($data); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertFalse($node->isAttached()); unset($data['dn']); $this->assertEquals($data, $node->getData()); @@ -122,7 +122,7 @@ public function testGetDnArray() { $data=$this->_createTestArrayData(); $node=Node::fromArray($data); - $exA=LDAP\DN::explodeDn($data['dn']); + $exA=Ldap\Dn::explodeDn($data['dn']); $this->assertEquals($exA, $node->getDnArray()); } @@ -130,7 +130,7 @@ public function testGetDnObject() { $data=$this->_createTestArrayData(); $node=Node::fromArray($data); - $compareDn=LDAP\DN::fromString('cn=name,dc=example,dc=org'); + $compareDn=Ldap\Dn::fromString('cn=name,dc=example,dc=org'); $this->assertEquals($compareDn, $node->getDn()); $this->assertNotSame($node->getDn(), $node->getDn()); } @@ -301,7 +301,7 @@ public function testGetSetAndDeleteMethods() $this->assertTrue($node->existsAttribute('key', true)); $this->assertFalse($node->existsAttribute('key', false)); - $node->setPasswordAttribute('pa$$w0rd', LDAP\Attribute::PASSWORD_HASH_MD5); + $node->setPasswordAttribute('pa$$w0rd', Ldap\Attribute::PASSWORD_HASH_MD5); $this->assertEquals('{MD5}bJuLJ96h3bhF+WqiVnxnVA==', $node->getAttribute('userPassword', 0)); $this->assertTrue($node->existsAttribute('userPassword', true)); $this->assertTrue($node->existsAttribute('userPassword', false)); @@ -324,7 +324,7 @@ public function testOverloading() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testIllegalAttributeAccessRdnAttributeSet() { @@ -333,7 +333,7 @@ public function testIllegalAttributeAccessRdnAttributeSet() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testIllegalAttributeAccessDnSet() { @@ -436,7 +436,7 @@ public function testRenameNodeDnObject() $data=$this->_createTestArrayData(); $node=Node::fromArray($data); - $newDn=LDAP\DN::fromString('cn=test+ou=Lab+uid=tester,cn=name,dc=example,dc=org'); + $newDn=Ldap\Dn::fromString('cn=test+ou=Lab+uid=tester,cn=name,dc=example,dc=org'); $node->setDn($newDn); $this->assertEquals($data['dn'], $node->getCurrentDn()->toString()); $this->assertEquals($newDn, $node->getDn()); @@ -459,17 +459,17 @@ public function testRenameNodeFromDataSource() public function testDnObjectCloning() { $node1=$this->_createTestNode(); - $dn1=LDAP\DN::fromString('cn=name2,dc=example,dc=org'); + $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'); + $dn2=Ldap\Dn::fromString('cn=name2,dc=example,dc=org'); $node2=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'); + $dn3=Ldap\Dn::fromString('cn=name2,dc=example,dc=org'); $node3=Node::fromArray(array( 'dn' => $dn3, 'ou' => 'Test'), false); diff --git a/tests/Zend/LDAP/Node/OnlineTest.php b/tests/Zend/Ldap/Node/OnlineTest.php similarity index 86% rename from tests/Zend/LDAP/Node/OnlineTest.php rename to tests/Zend/Ldap/Node/OnlineTest.php index 0967eaf86fe..da967628e59 100644 --- a/tests/Zend/LDAP/Node/OnlineTest.php +++ b/tests/Zend/Ldap/Node/OnlineTest.php @@ -23,9 +23,9 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP\Node; -use Zend\LDAP; +namespace ZendTest\Ldap\Node; +use Zend\Ldap\Node; +use Zend\Ldap; /** * @category Zend @@ -36,7 +36,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class OnlineTest extends \ZendTest\LDAP\OnlineTestCase +class OnlineTest extends \ZendTest\Ldap\OnlineTestCase { protected function setUp() { @@ -54,7 +54,7 @@ public function testLoadFromLDAP() { $dn=$this->_createDn('ou=Test1,'); $node=Node::fromLDAP($dn, $this->_getLDAP()); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertTrue($node->isAttached()); } @@ -64,39 +64,39 @@ public function testChangeReadOnlySystemAttributes() try { $node->setAttribute('createTimestamp', false); $this->fail('Expected exception for modification of read-only attribute createTimestamp'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot change attribute because it\'s read-only', $e->getMessage()); } try { $node->createTimestamp=false; $this->fail('Expected exception for modification of read-only attribute createTimestamp'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot change attribute because it\'s read-only', $e->getMessage()); } try { $node['createTimestamp']=false; $this->fail('Expected exception for modification of read-only attribute createTimestamp'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot change attribute because it\'s read-only', $e->getMessage()); } try { $node->appendToAttribute('createTimestamp', 'value'); $this->fail('Expected exception for modification of read-only attribute createTimestamp'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot change attribute because it\'s read-only', $e->getMessage()); } try { - $rdn=$node->getRdnArray(LDAP\DN::ATTR_CASEFOLD_LOWER); + $rdn=$node->getRdnArray(Ldap\Dn::ATTR_CASEFOLD_LOWER); $attr=key($rdn); $node->deleteAttribute($attr); $this->fail('Expected exception for modification of read-only attribute ' . $attr); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals('Cannot change attribute because it\'s part of the RDN', $e->getMessage()); } } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testLoadFromLDAPIllegalEntry() { @@ -108,7 +108,7 @@ public function testDetachAndReattach() { $dn=$this->_createDn('ou=Test1,'); $node=Node::fromLDAP($dn, $this->_getLDAP()); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertTrue($node->isAttached()); $node->detachLDAP(); $this->assertFalse($node->isAttached()); @@ -128,7 +128,7 @@ public function testSerialize() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testAttachToInvalidLDAP() { @@ -191,7 +191,7 @@ public function testGetNode() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testGetIllegalNode() { @@ -204,17 +204,17 @@ public function testGetBaseNode() $node=$this->_getLDAP()->getBaseNode(); $this->assertEquals(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, $node->getDnString()); - $dn=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\DN::ATTR_CASEFOLD_LOWER); + $dn=Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, + Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dn[0]['ou'], $node->getAttribute('ou', 0)); } public function testSearchSubtree() { $node=$this->_getLDAP()->getNode($this->_createDn('ou=Node,')); - $items=$node->searchSubtree('(objectClass=organizationalUnit)', LDAP\LDAP::SEARCH_SCOPE_SUB, + $items=$node->searchSubtree('(objectClass=organizationalUnit)', Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'ou'); - $this->assertType('Zend\LDAP\Node\Collection', $items); + $this->assertType('Zend\Ldap\Node\Collection', $items); $this->assertEquals(3, $items->count()); $i=0; @@ -223,14 +223,14 @@ public function testSearchSubtree() $this->_createDn('ou=Test1,ou=Node,'), $this->_createDn('ou=Test2,ou=Node,')); foreach ($items as $key => $node) { - $key=LDAP\DN::fromString($key)->toString(LDAP\DN::ATTR_CASEFOLD_LOWER); + $key=Ldap\Dn::fromString($key)->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER); $this->assertEquals($dns[$i], $key); if ($i === 0) { $this->assertEquals('Node', $node->ou[0]); } else { $this->assertEquals('Test' . $i, $node->ou[0]); } - $this->assertEquals($key, $node->getDnString(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals($key, $node->getDnString(Ldap\Dn::ATTR_CASEFOLD_LOWER)); $i++; } $this->assertEquals(3, $i); @@ -240,7 +240,7 @@ public function testCountSubtree() { $node=$this->_getLDAP()->getNode(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); $this->assertEquals(9, $node->countSubtree('(objectClass=organizationalUnit)', - LDAP\LDAP::SEARCH_SCOPE_SUB)); + Ldap\Ldap::SEARCH_SCOPE_SUB)); } public function testCountChildren() @@ -263,13 +263,13 @@ public function testGetParent() { $node=$this->_getLDAP()->getNode($this->_createDn('ou=Node,')); $pnode=$node->getParent(); - $this->assertEquals(LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE) - ->toString(LDAP\DN::ATTR_CASEFOLD_LOWER), - $pnode->getDnString(LDAP\DN::ATTR_CASEFOLD_LOWER)); + $this->assertEquals(Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE) + ->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER), + $pnode->getDnString(Ldap\Dn::ATTR_CASEFOLD_LOWER)); } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testGetNonexistantParent() { @@ -279,9 +279,9 @@ public function testGetNonexistantParent() public function testLoadFromLDAPWithDnObject() { - $dn=LDAP\DN::fromString($this->_createDn('ou=Test1,')); + $dn=Ldap\Dn::fromString($this->_createDn('ou=Test1,')); $node=Node::fromLDAP($dn, $this->_getLDAP()); - $this->assertType('Zend\LDAP\Node', $node); + $this->assertType('Zend\Ldap\Node', $node); $this->assertTrue($node->isAttached()); } } diff --git a/tests/Zend/LDAP/Node/RootDseTest.php b/tests/Zend/Ldap/Node/RootDseTest.php similarity index 94% rename from tests/Zend/LDAP/Node/RootDseTest.php rename to tests/Zend/Ldap/Node/RootDseTest.php index f0c274c87f5..2b15322b8d4 100644 --- a/tests/Zend/LDAP/Node/RootDseTest.php +++ b/tests/Zend/Ldap/Node/RootDseTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP\Node\RootDSE; +namespace ZendTest\Ldap\Node; +use Zend\Ldap\Node\RootDse; /** * Zend_LDAP_OnlineTestCase @@ -39,7 +39,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class RootDSETest extends \ZendTest\LDAP\OnlineTestCase +class RootDseTest extends \ZendTest\Ldap\OnlineTestCase { public function testLoadRootDseNode() { @@ -62,7 +62,7 @@ public function testSupportCheckMethods() $this->assertType('boolean', $root->supportsVersion(array(3, 2))); switch ($root->getServerType()) { - case RootDSE::SERVER_TYPE_ACTIVEDIRECTORY: + case RootDse::SERVER_TYPE_ACTIVEDIRECTORY: $this->assertType('boolean', $root->supportsControl('1.2.840.113556.1.4.319')); $this->assertType('boolean', $root->supportsControl(array('1.2.840.113556.1.4.319', '1.2.840.113556.1.4.473'))); @@ -72,12 +72,12 @@ public function testSupportCheckMethods() $this->assertType('boolean', $root->supportsPolicy('unknown')); $this->assertType('boolean', $root->supportsPolicy(array('unknown', 'unknown'))); break; - case RootDSE::SERVER_TYPE_EDIRECTORY: + case RootDse::SERVER_TYPE_EDIRECTORY: $this->assertType('boolean', $root->supportsExtension('1.3.6.1.4.1.1466.20037')); $this->assertType('boolean', $root->supportsExtension(array('1.3.6.1.4.1.1466.20037', '1.3.6.1.4.1.4203.1.11.1'))); break; - case RootDSE::SERVER_TYPE_OPENLDAP: + case RootDse::SERVER_TYPE_OPENLDAP: $this->assertType('boolean', $root->supportsControl('1.3.6.1.4.1.4203.1.9.1.1')); $this->assertType('boolean', $root->supportsControl(array('1.3.6.1.4.1.4203.1.9.1.1', '2.16.840.1.113730.3.4.18'))); @@ -99,7 +99,7 @@ public function testGetters() $this->assertType('string', $root->getSubschemaSubentry()); switch ($root->getServerType()) { - case RootDSE::SERVER_TYPE_ACTIVEDIRECTORY: + case RootDse::SERVER_TYPE_ACTIVEDIRECTORY: $this->assertType('string', $root->getConfigurationNamingContext()); $this->assertType('string', $root->getCurrentTime()); $this->assertType('string', $root->getDefaultNamingContext()); @@ -116,7 +116,7 @@ public function testGetters() $this->assertType('string', $root->getSchemaNamingContext()); $this->assertType('string', $root->getServerName()); break; - case RootDSE::SERVER_TYPE_EDIRECTORY: + case RootDse::SERVER_TYPE_EDIRECTORY: $this->assertType('string', $root->getVendorName()); $this->assertType('string', $root->getVendorVersion()); $this->assertType('string', $root->getDsaName()); @@ -128,7 +128,7 @@ public function testGetters() $this->assertType('string', $root->getStatisticsAbandonOps()); $this->assertType('string', $root->getStatisticsWholeSubtreeSearchOps()); break; - case RootDSE::SERVER_TYPE_OPENLDAP: + case RootDse::SERVER_TYPE_OPENLDAP: $this->_assertNullOrString($root->getConfigContext()); $this->_assertNullOrString($root->getMonitorContext()); break; diff --git a/tests/Zend/LDAP/Node/SchemaTest.php b/tests/Zend/Ldap/Node/SchemaTest.php similarity index 93% rename from tests/Zend/LDAP/Node/SchemaTest.php rename to tests/Zend/Ldap/Node/SchemaTest.php index 32624982a55..5466e579152 100644 --- a/tests/Zend/LDAP/Node/SchemaTest.php +++ b/tests/Zend/Ldap/Node/SchemaTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP\Node\RootDSE; +namespace ZendTest\Ldap\Node; +use Zend\Ldap\Node\RootDse; /** * Zend_LDAP_OnlineTestCase @@ -39,7 +39,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class SchemaTest extends \ZendTest\LDAP\OnlineTestCase +class SchemaTest extends \ZendTest\Ldap\OnlineTestCase { /** * @var Zend_LDAP_Node_Schema @@ -71,11 +71,11 @@ public function testGetters() $this->assertType('array', $this->_schema->getObjectClasses()); switch ($this->_getLDAP()->getRootDse()->getServerType()) { - case RootDSE::SERVER_TYPE_ACTIVEDIRECTORY: + case RootDse::SERVER_TYPE_ACTIVEDIRECTORY: break; - case RootDSE::SERVER_TYPE_EDIRECTORY: + case RootDse::SERVER_TYPE_EDIRECTORY: break; - case RootDSE::SERVER_TYPE_OPENLDAP: + case RootDse::SERVER_TYPE_OPENLDAP: $this->assertType('array', $this->_schema->getLDAPSyntaxes()); $this->assertType('array', $this->_schema->getMatchingRules()); $this->assertType('array', $this->_schema->getMatchingRuleUse()); @@ -118,7 +118,7 @@ public function testOffsetUnsetWillThrowException() public function testOpenLDAPSchema() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } @@ -127,7 +127,7 @@ public function testOpenLDAPSchema() $this->assertArrayHasKey('organizationalUnit', $objectClasses); $ou=$objectClasses['organizationalUnit']; - $this->assertType('\Zend\LDAP\Node\Schema\ObjectClass\OpenLDAP', $ou); + $this->assertType('\Zend\Ldap\Node\Schema\ObjectClassOpenLdap', $ou); $this->assertEquals('organizationalUnit', $ou->getName()); $this->assertEquals('2.5.6.5', $ou->getOid()); $this->assertEquals(array('objectClass', 'ou'), $ou->getMustContain()); @@ -138,7 +138,7 @@ public function testOpenLDAPSchema() 'street', 'telephoneNumber', 'teletexTerminalIdentifier', 'telexNumber', 'userPassword', 'x121Address'), $ou->getMayContain()); $this->assertEquals('RFC2256: an organizational unit', $ou->getDescription()); - $this->assertEquals(\Zend\LDAP\Node\Schema::OBJECTCLASS_TYPE_STRUCTURAL, $ou->getType()); + $this->assertEquals(\Zend\Ldap\Node\Schema::OBJECTCLASS_TYPE_STRUCTURAL, $ou->getType()); $this->assertEquals(array('top'), $ou->getParentClasses()); $this->assertEquals('2.5.6.5', $ou->oid); @@ -168,7 +168,7 @@ public function testOpenLDAPSchema() $this->assertArrayHasKey('ou', $attributeTypes); $ou=$attributeTypes['ou']; - $this->assertType('\Zend\LDAP\Node\Schema\AttributeType\OpenLDAP', $ou); + $this->assertType('\Zend\Ldap\Node\Schema\AttributeTypeOpenLdap', $ou); $this->assertEquals('ou', $ou->getName()); $this->assertEquals('2.5.4.11', $ou->getOid()); $this->assertEquals('1.3.6.1.4.1.1466.115.121.1.15', $ou->getSyntax()); @@ -199,7 +199,7 @@ public function testOpenLDAPSchema() public function testActiveDirectorySchema() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_ACTIVEDIRECTORY) { + RootDse::SERVER_TYPE_ACTIVEDIRECTORY) { $this->markTestSkipped('Test can only be run on an Active Directory server'); } @@ -210,7 +210,7 @@ public function testActiveDirectorySchema() public function testeDirectorySchema() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_EDIRECTORY) { + RootDse::SERVER_TYPE_EDIRECTORY) { $this->markTestSkipped('Test can only be run on an eDirectory server'); } $this->markTestIncomplete("Novell eDirectory schema parsing is incomplete"); @@ -219,7 +219,7 @@ public function testeDirectorySchema() public function testOpenLDAPSchemaAttributeTypeInheritance() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } @@ -253,7 +253,7 @@ public function testOpenLDAPSchemaAttributeTypeInheritance() public function testOpenLDAPSchemaObjectClassInheritance() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } @@ -290,7 +290,7 @@ public function testOpenLDAPSchemaObjectClassInheritance() public function testOpenLDAPSchemaAttributeTypeAliases() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } @@ -305,7 +305,7 @@ public function testOpenLDAPSchemaAttributeTypeAliases() public function testOpenLDAPSchemaObjectClassAliases() { if ($this->_getLDAP()->getRootDse()->getServerType() !== - RootDSE::SERVER_TYPE_OPENLDAP) { + RootDse::SERVER_TYPE_OPENLDAP) { $this->markTestSkipped('Test can only be run on an OpenLDAP server'); } diff --git a/tests/Zend/LDAP/Node/UpdateTest.php b/tests/Zend/Ldap/Node/UpdateTest.php similarity index 98% rename from tests/Zend/LDAP/Node/UpdateTest.php rename to tests/Zend/Ldap/Node/UpdateTest.php index 0a1ccb9a1e0..a64b2f191ef 100644 --- a/tests/Zend/LDAP/Node/UpdateTest.php +++ b/tests/Zend/Ldap/Node/UpdateTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP\Node; -use Zend\LDAP\Node; +namespace ZendTest\Ldap\Node; +use Zend\Ldap\Node; /** @@ -36,7 +36,7 @@ * @group Zend_LDAP * @group Zend_LDAP_Node */ -class UpdateTest extends \ZendTest\LDAP\OnlineTestCase +class UpdateTest extends \ZendTest\Ldap\OnlineTestCase { protected function setUp() { diff --git a/tests/Zend/LDAP/OfflineTest.php b/tests/Zend/Ldap/OfflineTest.php similarity index 94% rename from tests/Zend/LDAP/OfflineTest.php rename to tests/Zend/Ldap/OfflineTest.php index 922c2b71c56..34fb037df92 100644 --- a/tests/Zend/LDAP/OfflineTest.php +++ b/tests/Zend/Ldap/OfflineTest.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** * @category Zend @@ -55,7 +55,7 @@ public function setUp() if (!extension_loaded('ldap')) { $this->markTestSkipped('LDAP is not enabled'); } - $this->_ldap = new LDAP\LDAP(); + $this->_ldap = new Ldap\Ldap(); } /** @@ -67,19 +67,19 @@ public function testInvalidOptionResultsInException() try { $this->_ldap->setOptions(array($optionName => 'irrelevant')); $this->fail('Expected Zend_LDAP_Exception not thrown'); - } catch (LDAP\Exception $e) { + } catch (Ldap\Exception $e) { $this->assertEquals("Unknown Zend_LDAP option: $optionName", $e->getMessage()); } } public function testException() { - $e = new LDAP\Exception(null, '', 0); + $e = new Ldap\Exception(null, '', 0); $this->assertEquals('no exception message', $e->getMessage()); $this->assertEquals(0, $e->getCode()); $this->assertEquals(0, $e->getErrorCode()); - $e = new LDAP\Exception(null, '', 15); + $e = new Ldap\Exception(null, '', 15); $this->assertEquals('0xf: no exception message', $e->getMessage()); $this->assertEquals(15, $e->getCode()); $this->assertEquals(15, $e->getErrorCode()); @@ -93,7 +93,7 @@ public function testOptionsGetter() 'password' => TESTS_ZEND_LDAP_PASSWORD, 'baseDn' => TESTS_ZEND_LDAP_BASE_DN, ); - $ldap = new LDAP\LDAP($options); + $ldap = new Ldap\Ldap($options); $this->assertEquals(array( 'host' => TESTS_ZEND_LDAP_HOST, 'port' => 0, @@ -124,7 +124,7 @@ public function testConfigObject() 'password' => TESTS_ZEND_LDAP_PASSWORD, 'baseDn' => TESTS_ZEND_LDAP_BASE_DN, )); - $ldap = new LDAP\LDAP($config); + $ldap = new Ldap\Ldap($config); $this->assertEquals(array( 'host' => TESTS_ZEND_LDAP_HOST, 'port' => 0, diff --git a/tests/Zend/LDAP/OnlineTestCase.php b/tests/Zend/Ldap/OnlineTestCase.php similarity index 96% rename from tests/Zend/LDAP/OnlineTestCase.php rename to tests/Zend/Ldap/OnlineTestCase.php index 83a84f34341..996e73c5334 100644 --- a/tests/Zend/LDAP/OnlineTestCase.php +++ b/tests/Zend/Ldap/OnlineTestCase.php @@ -23,8 +23,8 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; +namespace ZendTest\Ldap; +use Zend\Ldap; /** * @category Zend @@ -81,7 +81,7 @@ protected function setUp() if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT')) $options['accountDomainNameShort'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT; - $this->_ldap=new LDAP\LDAP($options); + $this->_ldap=new Ldap\Ldap($options); $this->_ldap->bind(); } @@ -99,7 +99,7 @@ protected function _createDn($dn) $dn.=','; } $dn = $dn . TESTS_ZEND_LDAP_WRITEABLE_SUBTREE; - return LDAP\DN::fromString($dn)->toString(LDAP\DN::ATTR_CASEFOLD_LOWER); + return Ldap\Dn::fromString($dn)->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER); } protected function _prepareLDAPServer() diff --git a/tests/Zend/LDAP/SearchTest.php b/tests/Zend/Ldap/SearchTest.php similarity index 85% rename from tests/Zend/LDAP/SearchTest.php rename to tests/Zend/Ldap/SearchTest.php index 1da50f49ef4..0e070672617 100644 --- a/tests/Zend/LDAP/SearchTest.php +++ b/tests/Zend/Ldap/SearchTest.php @@ -23,10 +23,10 @@ /** * @namespace */ -namespace ZendTest\LDAP; -use Zend\LDAP; -use Zend\LDAP\Filter; -use Zend\LDAP\Collection; +namespace ZendTest\Ldap; +use Zend\Ldap; +use Zend\Ldap\Filter; +use Zend\Ldap\Collection; /** @@ -69,7 +69,7 @@ public function testGetSingleIllegalEntry() } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testGetSingleIllegalEntryWithException() { @@ -80,34 +80,34 @@ public function testGetSingleIllegalEntryWithException() public function testCountBase() { $dn=$this->_createDn('ou=Node,'); - $count=$this->_getLDAP()->count('(objectClass=*)', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $count=$this->_getLDAP()->count('(objectClass=*)', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $this->assertEquals(1, $count); } public function testCountOne() { $dn1=$this->_createDn('ou=Node,'); - $count1=$this->_getLDAP()->count('(objectClass=*)', $dn1, LDAP\LDAP::SEARCH_SCOPE_ONE); + $count1=$this->_getLDAP()->count('(objectClass=*)', $dn1, Ldap\Ldap::SEARCH_SCOPE_ONE); $this->assertEquals(2, $count1); $dn2=TESTS_ZEND_LDAP_WRITEABLE_SUBTREE; - $count2=$this->_getLDAP()->count('(objectClass=*)', $dn2, LDAP\LDAP::SEARCH_SCOPE_ONE); + $count2=$this->_getLDAP()->count('(objectClass=*)', $dn2, Ldap\Ldap::SEARCH_SCOPE_ONE); $this->assertEquals(6, $count2); } public function testCountSub() { $dn1=$this->_createDn('ou=Node,'); - $count1=$this->_getLDAP()->count('(objectClass=*)', $dn1, LDAP\LDAP::SEARCH_SCOPE_SUB); + $count1=$this->_getLDAP()->count('(objectClass=*)', $dn1, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(3, $count1); $dn2=TESTS_ZEND_LDAP_WRITEABLE_SUBTREE; - $count2=$this->_getLDAP()->count('(objectClass=*)', $dn2, LDAP\LDAP::SEARCH_SCOPE_SUB); + $count2=$this->_getLDAP()->count('(objectClass=*)', $dn2, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(9, $count2); } public function testResultIteration() { $items=$this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(9, $items->count()); $this->assertEquals(9, count($items)); @@ -126,31 +126,31 @@ public function testResultIteration() public function testSearchNoResult() { $items=$this->_getLDAP()->search('(objectClass=account)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB); + Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(0, $items->count()); } public function testSearchEntriesShortcut() { $entries=$this->_getLDAP()->searchEntries('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertType("array", $entries); $this->assertEquals(9, count($entries)); } /** - * @expectedException Zend\LDAP\Exception + * @expectedException Zend\Ldap\Exception */ public function testIllegalSearch() { $dn=$this->_createDn('ou=Node2,'); - $items=$this->_getLDAP()->search('(objectClass=account)', $dn, LDAP\LDAP::SEARCH_SCOPE_SUB); + $items=$this->_getLDAP()->search('(objectClass=account)', $dn, Ldap\Ldap::SEARCH_SCOPE_SUB); } public function testSearchNothingGetFirst() { $entries=$this->_getLDAP()->search('(objectClass=account)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB); + Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(0, $entries->count()); $this->assertNull($entries->getFirst()); } @@ -159,7 +159,7 @@ public function testSorting() { $lSorted=array('a', 'b', 'c', 'd', 'e'); $items=$this->_getLDAP()->search('(l=*)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB, array(), 'l'); + Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'l'); $this->assertEquals(5, $items->count()); foreach ($items as $key => $item) { @@ -187,41 +187,41 @@ public function testExistsDn() public function testSearchWithDnObjectAndFilterObject() { - $dn=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); + $dn=Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); $filter=Filter::equals('objectClass', 'organizationalUnit'); - $items=$this->_getLDAP()->search($filter, $dn, LDAP\LDAP::SEARCH_SCOPE_SUB); + $items=$this->_getLDAP()->search($filter, $dn, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(9, $items->count()); } public function testCountSubWithDnObjectAndFilterObject() { - $dn1=LDAP\DN::fromString($this->_createDn('ou=Node,')); + $dn1=Ldap\Dn::fromString($this->_createDn('ou=Node,')); $filter=Filter::any('objectClass'); - $count1=$this->_getLDAP()->count($filter, $dn1, LDAP\LDAP::SEARCH_SCOPE_SUB); + $count1=$this->_getLDAP()->count($filter, $dn1, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(3, $count1); - $dn2=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); - $count2=$this->_getLDAP()->count($filter, $dn2, LDAP\LDAP::SEARCH_SCOPE_SUB); + $dn2=Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); + $count2=$this->_getLDAP()->count($filter, $dn2, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(9, $count2); } public function testCountChildrenWithDnObject() { - $dn1=LDAP\DN::fromString($this->_createDn('ou=Node,')); + $dn1=Ldap\Dn::fromString($this->_createDn('ou=Node,')); $count1=$this->_getLDAP()->countChildren($dn1); $this->assertEquals(2, $count1); - $dn2=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); + $dn2=Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); $count2=$this->_getLDAP()->countChildren($dn2); $this->assertEquals(6, $count2); } public function testExistsDnWithDnObject() { - $dn1=LDAP\DN::fromString($this->_createDn('ou=Test2,')); - $dn2=LDAP\DN::fromString($this->_createDn('ou=Test99,')); + $dn1=Ldap\Dn::fromString($this->_createDn('ou=Test2,')); + $dn2=Ldap\Dn::fromString($this->_createDn('ou=Test99,')); $this->assertTrue($this->_getLDAP()->exists($dn1)); $this->assertFalse($this->_getLDAP()->exists($dn2)); @@ -229,17 +229,17 @@ public function testExistsDnWithDnObject() public function testSearchEntriesShortcutWithDnObjectAndFilterObject() { - $dn=LDAP\DN::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); + $dn=Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE); $filter=Filter::equals('objectClass', 'organizationalUnit'); - $entries=$this->_getLDAP()->searchEntries($filter, $dn, LDAP\LDAP::SEARCH_SCOPE_SUB); + $entries=$this->_getLDAP()->searchEntries($filter, $dn, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertType("array", $entries); $this->assertEquals(9, count($entries)); } public function testGetSingleEntryWithDnObject() { - $dn=LDAP\DN::fromString($this->_createDn('ou=Test1,')); + $dn=Ldap\Dn::fromString($this->_createDn('ou=Test1,')); $entry=$this->_getLDAP()->getEntry($dn); $this->assertEquals($dn->toString(), $entry["dn"]); } @@ -247,7 +247,7 @@ public function testGetSingleEntryWithDnObject() public function testMultipleResultIteration() { $items=$this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $isCount = 9; $this->assertEquals($isCount, $items->count()); @@ -291,7 +291,7 @@ public function testMultipleResultIteration() public function testCallingNextAfterIterationShouldNotThrowException() { $items = $this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); foreach ($items as $key => $item) { // do nothing - just iterate } @@ -302,10 +302,10 @@ public function testUnknownCollectionClassThrowsException() { try { $items=$this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB, array(), null, + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB, array(), null, 'This_Class_Does_Not_Exist'); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains("Class 'This_Class_Does_Not_Exist' can not be found", $zle->getMessage()); } @@ -317,15 +317,15 @@ public function testCollectionClassNotSubclassingZendLDAPCollectionThrowsExcepti $items=$this->_getLDAP()->search( '(objectClass=organizationalUnit)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB, + Ldap\Ldap::SEARCH_SCOPE_SUB, array(), null, - 'ZendTest\LDAP\CollectionClassNotSubclassingZendLDAPCollection' + 'ZendTest\Ldap\CollectionClassNotSubclassingZendLDAPCollection' ); $this->fail('Expected exception not thrown'); - } catch (LDAP\Exception $zle) { + } catch (Ldap\Exception $zle) { $this->assertContains( - "Class 'ZendTest\LDAP\CollectionClassNotSubclassingZendLDAPCollection' must subclass 'Zend\LDAP\Collection'", + "Class 'ZendTest\Ldap\CollectionClassNotSubclassingZendLDAPCollection' must subclass 'Zend\Ldap\Collection'", $zle->getMessage()); } } @@ -338,7 +338,7 @@ public function testSearchWithOptionsArray() $items=$this->_getLDAP()->search(array( 'filter' => '(objectClass=organizationalUnit)', 'baseDn' => TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - 'scope' => LDAP\LDAP::SEARCH_SCOPE_SUB + 'scope' => Ldap\Ldap::SEARCH_SCOPE_SUB )); $this->assertEquals(9, $items->count()); } @@ -351,7 +351,7 @@ public function testSearchEntriesShortcutWithOptionsArray() $items=$this->_getLDAP()->searchEntries(array( 'filter' => '(objectClass=organizationalUnit)', 'baseDn' => TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - 'scope' => LDAP\LDAP::SEARCH_SCOPE_SUB + 'scope' => Ldap\Ldap::SEARCH_SCOPE_SUB )); $this->assertEquals(9, count($items)); } @@ -363,7 +363,7 @@ public function testReverseSortingWithSearchEntriesShortcut() { $lSorted = array('e', 'd', 'c', 'b', 'a'); $items = $this->_getLDAP()->searchEntries('(l=*)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB, array(), 'l', true); + Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'l', true); foreach ($items as $key => $item) { $this->assertEquals($lSorted[$key], $item['l'][0]); } @@ -378,7 +378,7 @@ public function testReverseSortingWithSearchEntriesShortcutWithOptionsArray() $items = $this->_getLDAP()->searchEntries(array( 'filter' => '(l=*)', 'baseDn' => TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - 'scope' => LDAP\LDAP::SEARCH_SCOPE_SUB, + 'scope' => Ldap\Ldap::SEARCH_SCOPE_SUB, 'sort' => 'l', 'reverseSort' => true )); @@ -390,7 +390,7 @@ public function testReverseSortingWithSearchEntriesShortcutWithOptionsArray() public function testSearchNothingIteration() { $entries = $this->_getLDAP()->search('(objectClass=account)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB, + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'uid'); $this->assertEquals(0, $entries->count()); $i = 0; @@ -403,7 +403,7 @@ public function testSearchNothingIteration() public function testSearchNothingToArray() { $entries = $this->_getLDAP()->search('(objectClass=account)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB, + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'uid'); $entries = $entries->toArray(); $this->assertEquals(0, count($entries)); @@ -442,8 +442,8 @@ public function testUserIsAutomaticallyBoundOnOperationInUnboundState() public function testInnerIteratorIsOfRequiredType() { $items = $this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); - $this->assertType('\Zend\LDAP\Collection\DefaultIterator', $items->getInnerIterator()); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); + $this->assertType('\Zend\Ldap\Collection\DefaultIterator', $items->getInnerIterator()); } /** @@ -452,7 +452,7 @@ public function testInnerIteratorIsOfRequiredType() public function testCallingCurrentOnIteratorReturnsFirstElement() { $items = $this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, $items->getInnerIterator()->key()); $current = $items->getInnerIterator()->current(); $this->assertType('array', $current); @@ -465,7 +465,7 @@ public function testCallingCurrentOnIteratorReturnsFirstElement() public function testCallingCurrentOnCollectionReturnsFirstElement() { $items = $this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(0, $items->key()); $this->assertEquals(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, $items->dn()); $current = $items->current(); @@ -479,7 +479,7 @@ public function testCallingCurrentOnCollectionReturnsFirstElement() public function testCallingCurrentOnEmptyIteratorReturnsNull() { $items = $this->_getLDAP()->search('(objectClass=account)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB); + Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertNull($items->getInnerIterator()->key()); $this->assertNull($items->getInnerIterator()->current()); } @@ -490,7 +490,7 @@ public function testCallingCurrentOnEmptyIteratorReturnsNull() public function testCallingCurrentOnEmptyCollectionReturnsNull() { $items = $this->_getLDAP()->search('(objectClass=account)', TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, - LDAP\LDAP::SEARCH_SCOPE_SUB); + Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertNull($items->key()); $this->assertNull($items->dn()); $this->assertNull($items->current()); @@ -502,7 +502,7 @@ public function testCallingCurrentOnEmptyCollectionReturnsNull() public function testResultIterationAfterCallingCurrent() { $items = $this->_getLDAP()->search('(objectClass=organizationalUnit)', - TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, LDAP\LDAP::SEARCH_SCOPE_SUB); + TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, Ldap\Ldap::SEARCH_SCOPE_SUB); $this->assertEquals(9, $items->count()); $this->assertEquals(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, $items->getInnerIterator()->key()); $current = $items->current(); @@ -527,7 +527,7 @@ public function testResultIterationAfterCallingCurrent() public function testAttributeNameTreatmentToLower() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $list->getInnerIterator()->setAttributeNameTreatment(Collection\DefaultIterator::ATTRIBUTE_TO_LOWER); $this->assertArrayHasKey('postalcode', $list->current()); } @@ -538,7 +538,7 @@ public function testAttributeNameTreatmentToLower() public function testAttributeNameTreatmentToUpper() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $list->getInnerIterator()->setAttributeNameTreatment(Collection\DefaultIterator::ATTRIBUTE_TO_UPPER); $this->assertArrayHasKey('POSTALCODE', $list->current()); } @@ -549,7 +549,7 @@ public function testAttributeNameTreatmentToUpper() public function testAttributeNameTreatmentNative() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $list->getInnerIterator()->setAttributeNameTreatment(Collection\DefaultIterator::ATTRIBUTE_NATIVE); $this->assertArrayHasKey('postalCode', $list->current()); } @@ -560,8 +560,8 @@ public function testAttributeNameTreatmentNative() public function testAttributeNameTreatmentCustomFunction() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); - $list->getInnerIterator()->setAttributeNameTreatment('ZendTest\LDAP\customNaming'); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); + $list->getInnerIterator()->setAttributeNameTreatment('ZendTest\Ldap\customNaming'); $this->assertArrayHasKey('EDOCLATSOP', $list->current()); } @@ -571,7 +571,7 @@ public function testAttributeNameTreatmentCustomFunction() public function testAttributeNameTreatmentCustomStaticMethod() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $list->getInnerIterator()->setAttributeNameTreatment(array(__NAMESPACE__ . '\CustomNaming', 'name1')); $this->assertArrayHasKey('edoclatsop', $list->current()); } @@ -582,7 +582,7 @@ public function testAttributeNameTreatmentCustomStaticMethod() public function testAttributeNameTreatmentCustomInstanceMethod() { $dn = $this->_createDn('ou=Node,'); - $list = $this->_getLDAP()->search('objectClass=*', $dn, LDAP\LDAP::SEARCH_SCOPE_BASE); + $list = $this->_getLDAP()->search('objectClass=*', $dn, Ldap\Ldap::SEARCH_SCOPE_BASE); $namer = new CustomNaming(); $list->getInnerIterator()->setAttributeNameTreatment(array($namer, 'name2')); $this->assertArrayHasKey('edoClatsop', $list->current()); diff --git a/tests/Zend/LDAP/TestCase.php b/tests/Zend/Ldap/TestCase.php similarity index 94% rename from tests/Zend/LDAP/TestCase.php rename to tests/Zend/Ldap/TestCase.php index a154e6eceae..803ad8efbbc 100644 --- a/tests/Zend/LDAP/TestCase.php +++ b/tests/Zend/Ldap/TestCase.php @@ -23,7 +23,7 @@ /** * @namespace */ -namespace ZendTest\LDAP; +namespace ZendTest\Ldap; /** @@ -57,6 +57,6 @@ protected function _createTestArrayData() */ protected function _createTestNode() { - return \Zend\LDAP\Node::fromArray($this->_createTestArrayData(), true); + return \Zend\Ldap\Node::fromArray($this->_createTestArrayData(), true); } } diff --git a/tests/Zend/LDAP/_files/AttributeTest.input.txt b/tests/Zend/Ldap/_files/AttributeTest.input.txt similarity index 100% rename from tests/Zend/LDAP/_files/AttributeTest.input.txt rename to tests/Zend/Ldap/_files/AttributeTest.input.txt