xref: /php-src/ext/ldap/tests/ldap_delete_ext.phpt (revision 69a8b63e)
1--TEST--
2ldap_delete_ext() - Delete operation with controls
3--CREDITS--
4Côme Chilliet <mcmic@php.net>
5--EXTENSIONS--
6ldap
7--SKIPIF--
8<?php require_once('skipifbindfailure.inc'); ?>
9<?php
10require_once('skipifcontrol.inc');
11skipifunsupportedcontrol(LDAP_CONTROL_PRE_READ);
12?>
13--FILE--
14<?php
15require "connect.inc";
16
17$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
18ldap_add($link, "dc=my-domain,$base", array(
19    "objectClass"	=> array(
20        "top",
21        "dcObject",
22        "organization"),
23    "dc"			=> "my-domain",
24    "o"				=> "my-domain",
25));
26
27var_dump(
28    $result = ldap_delete_ext($link, "dc=my-domain,$base",
29        [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]]
30    ),
31    ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
32    $errcode,
33    $errmsg,
34    $ctrls[LDAP_CONTROL_PRE_READ],
35    @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
36);
37?>
38--CLEAN--
39<?php
40require "connect.inc";
41
42$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
43
44@ldap_delete($link, "dc=my-domain,$base");
45?>
46--EXPECTF--
47object(LDAP\Result)#%d (0) {
48}
49bool(true)
50int(0)
51string(0) ""
52array(2) {
53  ["oid"]=>
54  string(14) "1.3.6.1.1.13.1"
55  ["value"]=>
56  array(3) {
57    ["dn"]=>
58    string(%d) "dc=my-domain,%s"
59    ["dc"]=>
60    array(1) {
61      [0]=>
62      string(9) "my-domain"
63    }
64    ["o"]=>
65    array(1) {
66      [0]=>
67      string(9) "my-domain"
68    }
69  }
70}
71bool(false)
72