com php-src: Updated README, added test to create LDAP base if missing and ease tests: ext/ldap/tests/README ext/ldap/tests/connect.inc
ext/ldap/tests/ldap_control_paged_results_variation1 .phpt ext/ldap/tests/ldap_control_paged_results_var iation2.phpt
| From: | Côme Bernigaud | Date: | Mon, 06 Jul 2015 12:26:49 +0000 |
| Subject: | com php-src: Updated README, added test to create LDAP base if missing and ease tests: ext/ldap/tests/README ext/ldap/tests/connect.inc ext/ldap/tests/ldap_control_paged_results_variation1 .phpt ext/ldap/tests/ldap_control_paged_results_var iation2.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87760@lists.php.net to get a copy of this message | ||
Commit: 42f7e4c0445f3492396e05db4996cbdce362c73e
Author: Côme Bernigaud <mcmic@php.net> Mon, 6 Jul 2015 14:26:49 +0200
Parents: b27bcd90b357f155d3f6edec102525168c796ddc
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=42f7e4c0445f3492396e05db4996cbdce362c73e
Log:
Updated README, added test to create LDAP base if missing and ease tests
Changed paths:
M ext/ldap/tests/README
M ext/ldap/tests/connect.inc
M ext/ldap/tests/ldap_control_paged_results_variation1.phpt
M ext/ldap/tests/ldap_control_paged_results_variation2.phpt
Diff:
diff --git a/ext/ldap/tests/README b/ext/ldap/tests/README
index 7dccd27..4ac4d10 100644
--- a/ext/ldap/tests/README
+++ b/ext/ldap/tests/README
@@ -2,13 +2,16 @@ Most tests here relies on the availability of an LDAP server configured with TLS
Client/Server configuration:
===========================================================
-OpenLDAP 2.3.43 has been used with the configuration below.
+OpenLDAP 2.4.31 has been used with the configuration below.
Notes:
1. A self signed certificate can be generated using:
$ openssl req -newkey rsa:1024 -x509 -nodes -out server.pem -keyout server.pem -days 3650
It is used for testing ldap_start_tls(), which also requires "TLS_REQCERT never" in
client configuration
-2. An empty LDAP structure is required for the tests to be PASSed
+2. An empty LDAP structure is required for the tests to be PASSed (except for base and admin)
+
+If you use a debian based distribution, prefer the use of dpkg-reconfigure.
+Otherwise you may alter these configuration files:
(/etc/openldap/)slapd.conf:
-----------------------------------------------------------
@@ -40,6 +43,7 @@ Tests configuration:
The following environment variables may be defined:
LDAP_TEST_HOST (default: localhost) Host to connect to
LDAP_TEST_PORT (default: 389) Port to connect to
+LDAP_TEST_BASE (default: dc=my-domain,dc=com) Base to use. May be the ldap root or a
subtree. (ldap_search_variation6 will fail if a subtree is used)
LDAP_TEST_USER (default: cn=Manager,dc=my-domain,dc=com) DN used for binding
LDAP_TEST_SASL_USER (default: Manager) SASL user used for SASL binding
LDAP_TEST_PASSWD (default: secret) Password used for plain and SASL binding
@@ -50,4 +54,4 @@ Credits:
===========================================================
Davide Mendolia <idaf1er@gmail.com>
Patrick Allaert <patrick.allaert@gmail..com>
-
+Côme Bernigaud <mcmic@php.net>
diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc
index 002274c..f7379ac 100644
--- a/ext/ldap/tests/connect.inc
+++ b/ext/ldap/tests/connect.inc
@@ -22,6 +22,20 @@ function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version)
}
function insert_dummy_data($link, $base) {
+ // Create root if not there
+ $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
+ if (ldap_count_entries($link, $testBase) < 1) {
+ ldap_add(
+ $link, "$base", array(
+ "objectClass" => array(
+ "top",
+ "organization",
+ "dcObject"
+ ),
+ "o" => "php ldap tests"
+ )
+ );
+ }
ldap_add($link, "o=test,$base", array(
"objectClass" => array(
"top",
diff --git a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
index 862895e..cd189eb 100644
--- a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
+++ b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
@@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
-resource(6) of type (ldap result)
+resource(%d) of type (ldap result)
array(2) {
["count"]=>
int(1)
diff --git a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
index 4544a0b..7b1715c 100644
--- a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
+++ b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
@@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
-resource(6) of type (ldap result)
+resource(%d) of type (ldap result)
array(3) {
["count"]=>
int(2)