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