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