1--TEST-- 2ldap_mod_add() - ldap_mod_add() 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// DN not found 16var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); 17 18// Invalid DN 19var_dump(ldap_mod_add($link, "weirdAttribute=val", array())); 20 21$entry = array( 22 "objectClass" => array( 23 "top", 24 "dcObject", 25 "organization"), 26 "dc" => "my-domain", 27 "o" => "my-domain", 28); 29 30ldap_add($link, "dc=my-domain,$base", $entry); 31 32$entry2 = $entry; 33$entry2["dc"] = "Wrong Domain"; 34 35var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2)); 36 37$entry2 = $entry; 38$entry2["weirdAttribute"] = "weirdVal"; 39 40var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2)); 41?> 42--CLEAN-- 43<?php 44require "connect.inc"; 45 46$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 47 48ldap_delete($link, "dc=my-domain,$base"); 49?> 50--EXPECTF-- 51Warning: ldap_mod_add(): Modify: No such object in %s on line %d 52bool(false) 53 54Warning: ldap_mod_add(): Modify: Invalid DN syntax in %s on line %d 55bool(false) 56 57Warning: ldap_mod_add(): Modify: Type or value exists in %s on line %d 58bool(false) 59 60Warning: ldap_mod_add(): Modify: Undefined attribute type in %s on line %d 61bool(false) 62