ldap_add_basic.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --TEST--
  2. ldap_add() - Basic add operation
  3. --CREDITS--
  4. Patrick Allaert <patrickallaert@php.net>
  5. # Belgian PHP Testfest 2009
  6. --EXTENSIONS--
  7. ldap
  8. --SKIPIF--
  9. <?php require_once('skipifbindfailure.inc'); ?>
  10. --FILE--
  11. <?php
  12. require "connect.inc";
  13. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  14. var_dump(
  15. ldap_add($link, "dc=my-domain,$base", array(
  16. "objectClass" => array(
  17. "top",
  18. "dcObject",
  19. "organization"),
  20. "dc" => "my-domain",
  21. "o" => "my-domain",
  22. )),
  23. ldap_get_entries(
  24. $link,
  25. ldap_search($link, "$base", "(o=my-domain)")
  26. )
  27. );
  28. ?>
  29. --CLEAN--
  30. <?php
  31. require "connect.inc";
  32. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  33. ldap_delete($link, "dc=my-domain,$base");
  34. ?>
  35. --EXPECTF--
  36. bool(true)
  37. array(2) {
  38. ["count"]=>
  39. int(1)
  40. [0]=>
  41. array(8) {
  42. ["objectclass"]=>
  43. array(4) {
  44. ["count"]=>
  45. int(3)
  46. [0]=>
  47. string(3) "top"
  48. [1]=>
  49. string(8) "dcObject"
  50. [2]=>
  51. string(12) "organization"
  52. }
  53. [0]=>
  54. string(11) "objectclass"
  55. ["dc"]=>
  56. array(2) {
  57. ["count"]=>
  58. int(1)
  59. [0]=>
  60. string(9) "my-domain"
  61. }
  62. [1]=>
  63. string(2) "dc"
  64. ["o"]=>
  65. array(2) {
  66. ["count"]=>
  67. int(1)
  68. [0]=>
  69. string(9) "my-domain"
  70. }
  71. [2]=>
  72. string(1) "o"
  73. ["count"]=>
  74. int(3)
  75. ["dn"]=>
  76. string(%d) "dc=my-domain,%s"
  77. }
  78. }