xref: /PHP-8.0/ext/ldap/tests/ldap_read_basic.phpt (revision f8d79582)
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, $base);
18var_dump(
19    $result = ldap_read($link, "o=test,$base", "(o=*)"),
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(2) {
33  ["count"]=>
34  int(1)
35  [0]=>
36  array(6) {
37    ["objectclass"]=>
38    array(3) {
39      ["count"]=>
40      int(2)
41      [0]=>
42      string(3) "top"
43      [1]=>
44      string(12) "organization"
45    }
46    [0]=>
47    string(11) "objectclass"
48    ["o"]=>
49    array(2) {
50      ["count"]=>
51      int(1)
52      [0]=>
53      string(4) "test"
54    }
55    [1]=>
56    string(1) "o"
57    ["count"]=>
58    int(2)
59    ["dn"]=>
60    string(%d) "o=test,%s"
61  }
62}
63