diff options
| author | Côme Chilliet <mcmic@php.net> | 2017-09-07 09:33:01 +0200 |
|---|---|---|
| committer | Côme Chilliet <mcmic@php.net> | 2017-09-21 10:05:40 +0200 |
| commit | 79cfa55caeef1c89564dc0481bbbfe45f3e0d8bb (patch) | |
| tree | 24eaeb8c1c3f4ed46aaee1b7c90459ae03b4b3ac | |
| parent | 6d3a914641a084f32276b9f7ccf567f32a1ef142 (diff) | |
| download | php-git-79cfa55caeef1c89564dc0481bbbfe45f3e0d8bb.tar.gz | |
Added a test for assertion control
| -rw-r--r-- | ext/ldap/tests/ldap_controls.phpt | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt new file mode 100644 index 0000000000..3838da4ac8 --- /dev/null +++ b/ext/ldap/tests/ldap_controls.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test the use of controls +--CREDITS-- +Côme Chilliet <mcmic@php.net> +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifbindfailure.inc'); +?> +--FILE-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +insert_dummy_data($link, $base); + +/* Test assertion control */ +var_dump( + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'value' => ['filter' => '(objectClass=organization)']]]), + ldap_get_entries($link, $result), + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]) +); +?> +===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link, $base); +?> +--EXPECTF-- +Warning: ldap_search(): Search: Assertion Failed in %s on line %d +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["o"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(4) "test" + } + [0]=> + string(1) "o" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "o=test,%s" + } +} +bool(false) +===DONE=== |
