1--TEST--
2ldap_mod_del() - ldap_mod_del() operations 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_mod_del());
17var_dump(ldap_mod_del($link));
18var_dump(ldap_mod_del($link, "dc=my-domain,dc=com"));
19
20// Too many parameters
21var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array(), "Additional data"));
22
23// DN not found
24var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array()));
25
26// Invalid DN
27var_dump(ldap_mod_del($link, "weirdAttribute=val", array()));
28
29// Invalid attributes
30var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array('dc')));
31?>
32===DONE===
33--CLEAN--
34<?php
35require "connect.inc";
36
37$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
38
39ldap_delete($link, "dc=my-domain,dc=com");
40?>
41--EXPECTF--
42Warning: ldap_mod_del() expects exactly 3 parameters, 0 given in %s on line %d
43NULL
44
45Warning: ldap_mod_del() expects exactly 3 parameters, 1 given in %s on line %d
46NULL
47
48Warning: ldap_mod_del() expects exactly 3 parameters, 2 given in %s on line %d
49NULL
50
51Warning: ldap_mod_del() expects exactly 3 parameters, 4 given in %s on line %d
52NULL
53
54Warning: ldap_mod_del(): Modify: No such object in %s on line %d
55bool(false)
56
57Warning: ldap_mod_del(): Modify: Invalid DN syntax in %s on line %d
58bool(false)
59
60Warning: ldap_mod_del(): Unknown attribute in the data in %s on line %d
61bool(false)
62===DONE===
63