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);
18
19var_dump(
20	$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array('sn'), 1),
21	ldap_get_entries($link, $result)
22);
23?>
24===DONE===
25--CLEAN--
26<?php
27include "connect.inc";
28
29$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
30remove_dummy_data($link);
31?>
32--EXPECTF--
33resource(%d) of type (ldap result)
34array(4) {
35  ["count"]=>
36  int(3)
37  [0]=>
38  array(4) {
39    ["sn"]=>
40    array(1) {
41      ["count"]=>
42      int(0)
43    }
44    [0]=>
45    string(2) "sn"
46    ["count"]=>
47    int(1)
48    ["dn"]=>
49    string(28) "cn=userA,dc=my-domain,dc=com"
50  }
51  [1]=>
52  array(4) {
53    ["sn"]=>
54    array(1) {
55      ["count"]=>
56      int(0)
57    }
58    [0]=>
59    string(2) "sn"
60    ["count"]=>
61    int(1)
62    ["dn"]=>
63    string(28) "cn=userB,dc=my-domain,dc=com"
64  }
65  [2]=>
66  array(4) {
67    ["sn"]=>
68    array(1) {
69      ["count"]=>
70      int(0)
71    }
72    [0]=>
73    string(2) "sn"
74    ["count"]=>
75    int(1)
76    ["dn"]=>
77    string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
78  }
79}
80===DONE===
81