summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Bernigaud <mcmic@php.net>2015-07-06 14:28:01 +0200
committerCôme Bernigaud <mcmic@php.net>2015-07-06 14:28:01 +0200
commita09dcb0e13b809a8d8c646aff8449782d3b9ca18 (patch)
treea5d202d10c6545994c1110a35adae619372469f3
parent535b2cc02bbaf5684c4619303661a367fe8663f7 (diff)
parent42f7e4c0445f3492396e05db4996cbdce362c73e (diff)
downloadphp-git-a09dcb0e13b809a8d8c646aff8449782d3b9ca18.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: Updated README, added test to create LDAP base if missing and ease tests
-rw-r--r--ext/ldap/tests/README10
-rw-r--r--ext/ldap/tests/connect.inc14
-rw-r--r--ext/ldap/tests/ldap_control_paged_results_variation1.phpt2
-rw-r--r--ext/ldap/tests/ldap_control_paged_results_variation2.phpt2
4 files changed, 23 insertions, 5 deletions
diff --git a/ext/ldap/tests/README b/ext/ldap/tests/README
index b30043abce..4f3b07d6cd 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 002274cf55..f7379ac954 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 862895e81d..cd189ebf09 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 4544a0b85a..7b1715c21b 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)