1--TEST--
2ldap_mod_replace() - ldap_mod_replace() 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_replace());
17var_dump(ldap_mod_replace($link));
18var_dump(ldap_mod_replace($link, "$base"));
19
20// Too many parameters
21var_dump(ldap_mod_replace($link, "$base", array(), "Additional data"));
22
23// DN not found
24var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array()));
25
26// Invalid DN
27var_dump(ldap_mod_replace($link, "weirdAttribute=val", array()));
28
29// Invalid attributes
30var_dump(ldap_mod_replace($link, "$base", 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?>
39--EXPECTF--
40Warning: ldap_mod_replace() expects exactly 3 parameters, 0 given in %s on line %d
41NULL
42
43Warning: ldap_mod_replace() expects exactly 3 parameters, 1 given in %s on line %d
44NULL
45
46Warning: ldap_mod_replace() expects exactly 3 parameters, 2 given in %s on line %d
47NULL
48
49Warning: ldap_mod_replace() expects exactly 3 parameters, 4 given in %s on line %d
50NULL
51
52Warning: ldap_mod_replace(): Modify: No such object in %s on line %d
53bool(false)
54
55Warning: ldap_mod_replace(): Modify: Invalid DN syntax in %s on line %d
56bool(false)
57
58Warning: ldap_mod_replace(): Unknown attribute in the data in %s on line %d
59bool(false)
60===DONE===
61