xref: /PHP-8.0/ext/ldap/tests/ldap_list_basic.phpt (revision f8d79582)
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--CLEAN--
24<?php
25include "connect.inc";
26
27$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
28remove_dummy_data($link, $base);
29?>
30--EXPECTF--
31resource(%d) of type (ldap result)
32array(3) {
33  ["count"]=>
34  int(2)
35  [0]=>
36  array(14) {
37    ["objectclass"]=>
38    array(2) {
39      ["count"]=>
40      int(1)
41      [0]=>
42      string(6) "person"
43    }
44    [0]=>
45    string(11) "objectclass"
46    ["cn"]=>
47    array(2) {
48      ["count"]=>
49      int(1)
50      [0]=>
51      string(5) "userA"
52    }
53    [1]=>
54    string(2) "cn"
55    ["sn"]=>
56    array(2) {
57      ["count"]=>
58      int(1)
59      [0]=>
60      string(7) "testSN1"
61    }
62    [2]=>
63    string(2) "sn"
64    ["userpassword"]=>
65    array(2) {
66      ["count"]=>
67      int(1)
68      [0]=>
69      string(%d) "%s"
70    }
71    [3]=>
72    string(12) "userpassword"
73    ["telephonenumber"]=>
74    array(2) {
75      ["count"]=>
76      int(1)
77      [0]=>
78      string(14) "xx-xx-xx-xx-xx"
79    }
80    [4]=>
81    string(15) "telephonenumber"
82    ["description"]=>
83    array(2) {
84      ["count"]=>
85      int(1)
86      [0]=>
87      string(6) "user A"
88    }
89    [5]=>
90    string(11) "description"
91    ["count"]=>
92    int(6)
93    ["dn"]=>
94    string(%d) "cn=userA,%s"
95  }
96  [1]=>
97  array(12) {
98    ["objectclass"]=>
99    array(2) {
100      ["count"]=>
101      int(1)
102      [0]=>
103      string(6) "person"
104    }
105    [0]=>
106    string(11) "objectclass"
107    ["cn"]=>
108    array(2) {
109      ["count"]=>
110      int(1)
111      [0]=>
112      string(5) "userB"
113    }
114    [1]=>
115    string(2) "cn"
116    ["sn"]=>
117    array(2) {
118      ["count"]=>
119      int(1)
120      [0]=>
121      string(7) "testSN2"
122    }
123    [2]=>
124    string(2) "sn"
125    ["userpassword"]=>
126    array(2) {
127      ["count"]=>
128      int(1)
129      [0]=>
130      string(%d) "%s"
131    }
132    [3]=>
133    string(12) "userpassword"
134    ["description"]=>
135    array(2) {
136      ["count"]=>
137      int(1)
138      [0]=>
139      string(6) "user B"
140    }
141    [4]=>
142    string(11) "description"
143    ["count"]=>
144    int(5)
145    ["dn"]=>
146    string(%d) "cn=userB,%s"
147  }
148}
149