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