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);
18insert_dummy_data($link, $base);
19
20var_dump(
21    $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1),
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(4) {
40    ["sn"]=>
41    array(1) {
42      ["count"]=>
43      int(0)
44    }
45    [0]=>
46    string(2) "sn"
47    ["count"]=>
48    int(1)
49    ["dn"]=>
50    string(%d) "cn=userA,%s"
51  }
52  [1]=>
53  array(4) {
54    ["sn"]=>
55    array(1) {
56      ["count"]=>
57      int(0)
58    }
59    [0]=>
60    string(2) "sn"
61    ["count"]=>
62    int(1)
63    ["dn"]=>
64    string(%d) "cn=userB,%s"
65  }
66  [2]=>
67  array(4) {
68    ["sn"]=>
69    array(1) {
70      ["count"]=>
71      int(0)
72    }
73    [0]=>
74    string(2) "sn"
75    ["count"]=>
76    int(1)
77    ["dn"]=>
78    string(%d) "cn=userC,cn=userB,%s"
79  }
80}
81