1--TEST--
2ldap_modify() - Modify operations that should fail
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--EXTENSIONS--
7ldap
8--SKIPIF--
9<?php require_once('skipifbindfailure.inc'); ?>
10--FILE--
11<?php
12require "connect.inc";
13
14$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
15
16// DN not found
17var_dump(ldap_modify($link, "cn=not-found,$base", array()));
18
19// Invalid DN
20var_dump(ldap_modify($link, "weirdAttribute=val", array()));
21
22$entry = array(
23    "objectClass"	=> array(
24        "top",
25        "dcObject",
26        "organization"),
27    "dc"			=> "my-domain",
28    "o"				=> "my-domain",
29);
30
31ldap_add($link, "dc=my-domain,$base", $entry);
32
33$entry2 = $entry;
34$entry2["dc"] = "Wrong Domain";
35
36var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2));
37
38$entry2 = $entry;
39$entry2["weirdAttribute"] = "weirdVal";
40
41var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2));
42?>
43--CLEAN--
44<?php
45require "connect.inc";
46
47$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
48
49ldap_delete($link, "dc=my-domain,$base");
50?>
51--EXPECTF--
52Warning: ldap_modify(): Modify: No such object in %s on line %d
53bool(false)
54
55Warning: ldap_modify(): Modify: Invalid DN syntax in %s on line %d
56bool(false)
57
58Warning: ldap_modify(): Modify: Naming violation in %s on line %d
59bool(false)
60
61Warning: ldap_modify(): Modify: Undefined attribute type in %s on line %d
62bool(false)
63