1--TEST-- 2ldap_compare() - Testing ldap_compare() 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); 14insert_dummy_data($link); 15 16// Too few parameters 17var_dump(ldap_compare($link)); 18var_dump(ldap_compare($link, $link)); 19var_dump(ldap_compare($link, $link, $link)); 20 21// Too many parameters 22var_dump(ldap_compare($link, $link, $link, $link, "Additional data")); 23 24var_dump( 25 ldap_compare($link, "cn=userNotAvailable,dc=my-domain,dc=com", "sn", "testSN1"), 26 ldap_error($link), 27 ldap_errno($link) 28); 29?> 30===DONE=== 31--CLEAN-- 32<?php 33include "connect.inc"; 34 35$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 36remove_dummy_data($link); 37?> 38--EXPECTF-- 39Warning: ldap_compare() expects exactly 4 parameters, 1 given in %s on line %d 40NULL 41 42Warning: ldap_compare() expects exactly 4 parameters, 2 given in %s on line %d 43NULL 44 45Warning: ldap_compare() expects exactly 4 parameters, 3 given in %s on line %d 46NULL 47 48Warning: ldap_compare() expects exactly 4 parameters, 5 given in %s on line %d 49NULL 50 51Warning: ldap_compare(): Compare: No such object in %s on line %d 52int(-1) 53string(14) "No such object" 54int(32) 55===DONE=== 56