AttributeIterationTest.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Ldap
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Zend_Ldap_TestCase
  24. */
  25. require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestCase.php';
  26. /**
  27. * @see Zend_Ldap_Node
  28. */
  29. require_once 'Zend/Ldap/Node.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Ldap
  33. * @subpackage UnitTests
  34. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. * @group Zend_Ldap
  37. * @group Zend_Ldap_Node
  38. */
  39. class Zend_Ldap_Node_AttributeIterationTest extends Zend_Ldap_TestCase
  40. {
  41. public function testSimpleIteration()
  42. {
  43. $node=$this->_createTestNode();
  44. $i=0;
  45. $data=array();
  46. foreach ($node->getAttributes() as $k => $v) {
  47. $this->assertNotNull($k);
  48. $this->assertNotNull($v);
  49. $this->assertEquals($node->$k, $v);
  50. $data[$k]=$v;
  51. $i++;
  52. }
  53. $this->assertEquals(5, $i);
  54. $this->assertEquals($i, count($node));
  55. $this->assertEquals(array(
  56. 'boolean' => array(true, false),
  57. 'cn' => array('name'),
  58. 'empty' => array(),
  59. 'host' => array('a', 'b', 'c'),
  60. 'objectclass' => array('account', 'top')), $data);
  61. }
  62. }