1--TEST--
2ldap_delete() - Delete operation that should fail
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
14
15// Too few parameters
16var_dump(ldap_delete());
17var_dump(ldap_delete($link));
18
19// Too many parameters
20var_dump(ldap_delete($link, "$base", [], "Additional data"));
21
22// Invalid DN
23var_dump(
24	ldap_delete($link, "weirdAttribute=val"),
25	ldap_error($link),
26	ldap_errno($link)
27);
28
29// Deleting unexisting data
30var_dump(
31	ldap_delete($link, "dc=my-domain,$base"),
32	ldap_error($link),
33	ldap_errno($link)
34);
35?>
36===DONE===
37--CLEAN--
38<?php
39require "connect.inc";
40
41$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
42?>
43--EXPECTF--
44Warning: ldap_delete() expects at least 2 parameters, 0 given in %s on line %d
45NULL
46
47Warning: ldap_delete() expects at least 2 parameters, 1 given in %s on line %d
48NULL
49
50Warning: ldap_delete() expects at most 3 parameters, 4 given in %s on line %d
51NULL
52
53Warning: ldap_delete(): Delete: Invalid DN syntax in %s on line %d
54bool(false)
55string(17) "Invalid DN syntax"
56int(34)
57
58Warning: ldap_delete(): Delete: No such object in %s on line %d
59bool(false)
60string(14) "No such object"
61int(32)
62===DONE===
63