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