xref: /PHP-5.3/ext/ldap/tests/ldap_read_basic.phpt (revision 17aa2607)
1--TEST--
2ldap_read() 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);
18var_dump(
19	$result = ldap_read($link, "dc=my-domain,dc=com", "(dc=*)"),
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);
30?>
31--EXPECTF--
32resource(%d) of type (ldap result)
33array(2) {
34  ["count"]=>
35  int(1)
36  [0]=>
37  array(8) {
38    ["objectclass"]=>
39    array(4) {
40      ["count"]=>
41      int(3)
42      [0]=>
43      string(3) "top"
44      [1]=>
45      string(8) "dcObject"
46      [2]=>
47      string(12) "organization"
48    }
49    [0]=>
50    string(11) "objectclass"
51    ["dc"]=>
52    array(2) {
53      ["count"]=>
54      int(1)
55      [0]=>
56      string(9) "my-domain"
57    }
58    [1]=>
59    string(2) "dc"
60    ["o"]=>
61    array(2) {
62      ["count"]=>
63      int(1)
64      [0]=>
65      string(9) "my-domain"
66    }
67    [2]=>
68    string(1) "o"
69    ["count"]=>
70    int(3)
71    ["dn"]=>
72    string(19) "dc=my-domain,dc=com"
73  }
74}
75===DONE===
76