1--TEST-- 2ldap_search() test 3--CREDITS-- 4Davide Mendolia <idaf1er@gmail.com> 5Patrick Allaert <patrickallaert@php.net> 6Belgian PHP Testfest 2009 7--SKIPIF-- 8<?php 9require_once('skipif.inc'); 10require_once('skipifbindfailure.inc'); 11?> 12--FILE-- 13<?php 14include "connect.inc"; 15 16$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 17 18insert_dummy_data($link); 19var_dump( 20 $result = ldap_search($link, "dc=my-domain,dc=com", "(objectClass=person)"), 21 ldap_get_entries($link, $result) 22); 23?> 24===DONE=== 25--CLEAN-- 26<?php 27include "connect.inc"; 28 29$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 30remove_dummy_data($link); 31?> 32--EXPECTF-- 33resource(%d) of type (ldap result) 34array(4) { 35 ["count"]=> 36 int(3) 37 [0]=> 38 array(14) { 39 ["objectclass"]=> 40 array(2) { 41 ["count"]=> 42 int(1) 43 [0]=> 44 string(6) "person" 45 } 46 [0]=> 47 string(11) "objectclass" 48 ["cn"]=> 49 array(2) { 50 ["count"]=> 51 int(1) 52 [0]=> 53 string(5) "userA" 54 } 55 [1]=> 56 string(2) "cn" 57 ["sn"]=> 58 array(2) { 59 ["count"]=> 60 int(1) 61 [0]=> 62 string(7) "testSN1" 63 } 64 [2]=> 65 string(2) "sn" 66 ["userpassword"]=> 67 array(2) { 68 ["count"]=> 69 int(1) 70 [0]=> 71 string(4) "oops" 72 } 73 [3]=> 74 string(12) "userpassword" 75 ["telephonenumber"]=> 76 array(2) { 77 ["count"]=> 78 int(1) 79 [0]=> 80 string(14) "xx-xx-xx-xx-xx" 81 } 82 [4]=> 83 string(15) "telephonenumber" 84 ["description"]=> 85 array(2) { 86 ["count"]=> 87 int(1) 88 [0]=> 89 string(6) "user A" 90 } 91 [5]=> 92 string(11) "description" 93 ["count"]=> 94 int(6) 95 ["dn"]=> 96 string(28) "cn=userA,dc=my-domain,dc=com" 97 } 98 [1]=> 99 array(12) { 100 ["objectclass"]=> 101 array(2) { 102 ["count"]=> 103 int(1) 104 [0]=> 105 string(6) "person" 106 } 107 [0]=> 108 string(11) "objectclass" 109 ["cn"]=> 110 array(2) { 111 ["count"]=> 112 int(1) 113 [0]=> 114 string(5) "userB" 115 } 116 [1]=> 117 string(2) "cn" 118 ["sn"]=> 119 array(2) { 120 ["count"]=> 121 int(1) 122 [0]=> 123 string(7) "testSN2" 124 } 125 [2]=> 126 string(2) "sn" 127 ["userpassword"]=> 128 array(2) { 129 ["count"]=> 130 int(1) 131 [0]=> 132 string(15) "oopsIDitItAgain" 133 } 134 [3]=> 135 string(12) "userpassword" 136 ["description"]=> 137 array(2) { 138 ["count"]=> 139 int(1) 140 [0]=> 141 string(6) "user B" 142 } 143 [4]=> 144 string(11) "description" 145 ["count"]=> 146 int(5) 147 ["dn"]=> 148 string(28) "cn=userB,dc=my-domain,dc=com" 149 } 150 [2]=> 151 array(10) { 152 ["objectclass"]=> 153 array(2) { 154 ["count"]=> 155 int(1) 156 [0]=> 157 string(6) "person" 158 } 159 [0]=> 160 string(11) "objectclass" 161 ["cn"]=> 162 array(2) { 163 ["count"]=> 164 int(1) 165 [0]=> 166 string(5) "userC" 167 } 168 [1]=> 169 string(2) "cn" 170 ["sn"]=> 171 array(2) { 172 ["count"]=> 173 int(1) 174 [0]=> 175 string(7) "testSN3" 176 } 177 [2]=> 178 string(2) "sn" 179 ["userpassword"]=> 180 array(2) { 181 ["count"]=> 182 int(1) 183 [0]=> 184 string(17) "0r1g1na1 passw0rd" 185 } 186 [3]=> 187 string(12) "userpassword" 188 ["count"]=> 189 int(4) 190 ["dn"]=> 191 string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" 192 } 193} 194===DONE=== 195