xref: /php-src/ext/ldap/tests/ldap_list_basic.phpt (revision 69a8b63e)
1--TEST--
2ldap_list() 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($uri, $user, $passwd, $protocol_version);
18insert_dummy_data($link, $base);
19var_dump(
20    $result = ldap_list($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($uri, $user, $passwd, $protocol_version);
29remove_dummy_data($link, $base);
30?>
31--EXPECTF--
32object(LDAP\Result)#%d (0) {
33}
34array(3) {
35  ["count"]=>
36  int(2)
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(%d) "%s"
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(%d) "cn=userA,%s"
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(%d) "%s"
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(%d) "cn=userB,%s"
149  }
150}
151