xref: /PHP-7.2/ext/ldap/tests/ldap_list_basic.phpt (revision a5629f88)
1--TEST--
2ldap_list() 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);
17insert_dummy_data($link, $base);
18var_dump(
19	$result = ldap_list($link, "$base", "(objectClass=person)"),
20	ldap_get_entries($link, $result)
21);
22?>
23===DONE===
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(3) {
34  ["count"]=>
35  int(2)
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(4) "oops"
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(15) "oopsIDitItAgain"
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}
150===DONE===
151