com php-src: Added a test for assertion control: ext/ldap/tests /ldap_controls.phpt
| From: | Côme Bernigaud | Date: | Thu, 21 Sep 2017 08:05:40 +0000 |
| Subject: | com php-src: Added a test for assertion control: ext/ldap/tests /ldap_controls.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99504@lists.php.net to get a copy of this message | ||
Commit: 79cfa55caeef1c89564dc0481bbbfe45f3e0d8bb
Author: Côme Chilliet <mcmic@php.net> Thu, 7 Sep 2017 09:33:01 +0200
Parents: 6d3a914641a084f32276b9f7ccf567f32a1ef142
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=79cfa55caeef1c89564dc0481bbbfe45f3e0d8bb
Log:
Added a test for assertion control
Changed paths:
A ext/ldap/tests/ldap_controls.phpt
Diff:
diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt
new file mode 100644
index 0000000..3838da4
--- /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===