diff options
author | Côme Bernigaud <mcmic@php.net> | 2015-06-17 13:47:32 +0200 |
---|---|---|
committer | Côme Bernigaud <mcmic@php.net> | 2015-06-17 13:50:14 +0200 |
commit | 8836404fafad5b990ee7bbf0337bd86a619e7582 (patch) | |
tree | b53bdf33eec3ebf852c44bdd90f87fcc55272215 | |
parent | e4917bc747202d5071598221c5fc8c0ed8fe9465 (diff) | |
download | php-git-8836404fafad5b990ee7bbf0337bd86a619e7582.tar.gz |
Fixed LDAP tests so that base can exists
Now you can set the base in the env var LDAP_TEST_BASE.
The base has to exists. (before tests were attempting to create/delete
the base itself)
57 files changed, 348 insertions, 406 deletions
diff --git a/ext/ldap/tests/bug48441.phpt b/ext/ldap/tests/bug48441.phpt index 87256611d1..4f212e7402 100644 --- a/ext/ldap/tests/bug48441.phpt +++ b/ext/ldap/tests/bug48441.phpt @@ -12,9 +12,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(objectclass=person)"; var_dump( @@ -36,7 +36,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -57,7 +57,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -73,7 +73,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(4) { @@ -89,7 +89,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } @@ -110,7 +110,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } resource(%d) of type (ldap result) @@ -131,7 +131,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -147,7 +147,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(4) { @@ -163,7 +163,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc index ddb57828e9..002274cf55 100644 --- a/ext/ldap/tests/connect.inc +++ b/ext/ldap/tests/connect.inc @@ -1,13 +1,14 @@ <?php /* -Default values are "localhost", "root", database "test" and empty password. +Default values are "localhost", "cn=Manager,dc=my-domain,dc=com", and password "secret". Change the LDAP_TEST_* environment values if you want to use another configuration. */ $host = getenv("LDAP_TEST_HOST") ? getenv("LDAP_TEST_HOST") : "localhost"; $port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389; -$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,dc=my-domain,dc=com"; +$base = getenv("LDAP_TEST_BASE") ? getenv("LDAP_TEST_BASE") : "dc=my-domain,dc=com"; +$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,$base"; $sasl_user = getenv("LDAP_TEST_SASL_USER") ? getenv("LDAP_TEST_SASL_USER") : "Manager"; $passwd = getenv("LDAP_TEST_PASSWD") ? getenv("LDAP_TEST_PASSWD") : "secret"; $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3; @@ -20,16 +21,14 @@ function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version) return $link; } -function insert_dummy_data($link) { - ldap_add($link, "dc=my-domain,dc=com", array( +function insert_dummy_data($link, $base) { + ldap_add($link, "o=test,$base", array( "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "top", + "organization"), + "o" => "test", )); - ldap_add($link, "cn=userA,dc=my-domain,dc=com", array( + ldap_add($link, "cn=userA,$base", array( "objectclass" => "person", "cn" => "userA", "sn" => "testSN1", @@ -37,14 +36,14 @@ function insert_dummy_data($link) { "telephoneNumber" => "xx-xx-xx-xx-xx", "description" => "user A", )); - ldap_add($link, "cn=userB,dc=my-domain,dc=com", array( + ldap_add($link, "cn=userB,$base", array( "objectclass" => "person", "cn" => "userB", "sn" => "testSN2", "userPassword" => "oopsIDitItAgain", "description" => "user B", )); - ldap_add($link, "cn=userC,cn=userB,dc=my-domain,dc=com", array( + ldap_add($link, "cn=userC,cn=userB,$base", array( "objectclass" => "person", "cn" => "userC", "sn" => "testSN3", @@ -52,10 +51,10 @@ function insert_dummy_data($link) { )); } -function remove_dummy_data($link) { - ldap_delete($link, "cn=userC,cn=userB,dc=my-domain,dc=com"); - ldap_delete($link, "cn=userA,dc=my-domain,dc=com"); - ldap_delete($link, "cn=userB,dc=my-domain,dc=com"); - ldap_delete($link, "dc=my-domain,dc=com"); +function remove_dummy_data($link, $base) { + ldap_delete($link, "cn=userC,cn=userB,$base"); + ldap_delete($link, "cn=userA,$base"); + ldap_delete($link, "cn=userB,$base"); + ldap_delete($link, "o=test,$base"); } ?> diff --git a/ext/ldap/tests/ldap_add_basic.phpt b/ext/ldap/tests/ldap_add_basic.phpt index ca65e4986d..46fd6578db 100644 --- a/ext/ldap/tests/ldap_add_basic.phpt +++ b/ext/ldap/tests/ldap_add_basic.phpt @@ -13,7 +13,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump( - ldap_add($link, "dc=my-domain,dc=com", array( + ldap_add($link, "dc=my-domain,$base", array( "objectClass" => array( "top", "dcObject", @@ -23,7 +23,7 @@ var_dump( )), ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)") + ldap_search($link, "$base", "(o=my-domain)") ) ); ?> @@ -34,9 +34,9 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> @@ -77,7 +77,7 @@ array(2) { ["count"]=> int(3) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(%d) "dc=my-domain,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt index d17db6bfa3..a53277da80 100644 --- a/ext/ldap/tests/ldap_add_error.phpt +++ b/ext/ldap/tests/ldap_add_error.phpt @@ -15,12 +15,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Too few parameters var_dump(ldap_add()); var_dump(ldap_add($link)); -var_dump(ldap_add($link, "dc=my-domain,dc=com")); +var_dump(ldap_add($link, "$base")); // Too many parameters -var_dump(ldap_add($link, "dc=my-domain,dc=com", array(), "Additional data")); +var_dump(ldap_add($link, "$base", array(), "Additional data")); -var_dump(ldap_add($link, "dc=my-domain,dc=com", array())); +var_dump(ldap_add($link, "$base", array())); // Invalid DN var_dump( @@ -34,14 +34,14 @@ var_dump( // Duplicate entry for ($i = 0; $i < 2; $i++) var_dump( - ldap_add($link, "dc=my-domain,dc=com", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", - )) + ldap_add($link, "dc=my-domain,$base", array( + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", + )) ); var_dump(ldap_error($link), ldap_errno($link)); @@ -64,7 +64,7 @@ var_dump( // Invalid attribute var_dump( - ldap_add($link, "dc=my-domain,dc=com", array( + ldap_add($link, "$base", array( "objectClass" => array( "top", "dcObject", @@ -78,7 +78,7 @@ var_dump( ); var_dump( - ldap_add($link, "dc=my-domain,dc=com", array(array( "Oops" + ldap_add($link, "$base", array(array( "Oops" ))) /* Is this correct behaviour to still have "Undefined attribute type" as error/errno? , @@ -94,7 +94,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- Warning: ldap_add() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_compare_basic.phpt b/ext/ldap/tests/ldap_compare_basic.phpt index b0c5e97fb6..a8bb37f004 100644 --- a/ext/ldap/tests/ldap_compare_basic.phpt +++ b/ext/ldap/tests/ldap_compare_basic.phpt @@ -11,10 +11,10 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "sn", "testSN1"), - ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "telephoneNumber", "yy-yy-yy-yy-yy") + ldap_compare($link, "cn=userA,$base", "sn", "testSN1"), + ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy") ); ?> ===DONE=== @@ -23,7 +23,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- bool(true) diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt index 28127578fd..07393f6de6 100644 --- a/ext/ldap/tests/ldap_compare_error.phpt +++ b/ext/ldap/tests/ldap_compare_error.phpt @@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); // Too few parameters var_dump(ldap_compare($link)); @@ -22,7 +22,7 @@ var_dump(ldap_compare($link, $link, $link)); var_dump(ldap_compare($link, $link, $link, $link, "Additional data")); var_dump( - ldap_compare($link, "cn=userNotAvailable,dc=my-domain,dc=com", "sn", "testSN1"), + ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), ldap_error($link), ldap_errno($link) ); @@ -33,7 +33,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- Warning: ldap_compare() expects exactly 4 parameters, 1 given in %s on line %d diff --git a/ext/ldap/tests/ldap_connect_error.phpt b/ext/ldap/tests/ldap_connect_error.phpt index fa28fcf077..b93375c39e 100644 --- a/ext/ldap/tests/ldap_connect_error.phpt +++ b/ext/ldap/tests/ldap_connect_error.phpt @@ -13,7 +13,7 @@ require "connect.inc"; // too many arguments var_dump(ldap_connect(null, null, null)); -var_dump(ldap_connect("ldap://$host:$port/dc=my-domain,dc=com")); +var_dump(ldap_connect("ldap://$host:$port/$base")); $links = array(); $links[0] = ldap_connect($host, $port); diff --git a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt index 0e894464f4..862895e81d 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt @@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; -$filter = "(cn=*)"; +$dn = "$base"; +$filter = "(cn=user*)"; var_dump( ldap_control_paged_result($link, 1), $result = ldap_search($link, $dn, $filter, array('cn')), @@ -28,7 +28,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- bool(true) @@ -50,7 +50,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt index fee43fc4d6..4544a0b85a 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt @@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; -$filter = "(cn=*)"; +$dn = "$base"; +$filter = "(cn=user*)"; var_dump( ldap_control_paged_result($link, 2), $result = ldap_search($link, $dn, $filter, array('cn')), @@ -28,7 +28,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- bool(true) @@ -50,7 +50,7 @@ array(3) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -66,7 +66,7 @@ array(3) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt index 43a68aea79..24eae9615f 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt @@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; -$filter = "(cn=*)"; +$dn = "$base"; +$filter = "(cn=user*)"; $cookie = ''; var_dump( ldap_control_paged_result($link, 2, true, $cookie), @@ -33,7 +33,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- bool(true) @@ -55,7 +55,7 @@ array(3) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -71,7 +71,7 @@ array(3) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } } bool(true) @@ -94,7 +94,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_count_entries_basic.phpt b/ext/ldap/tests/ldap_count_entries_basic.phpt index a03f0596e9..7eef960614 100644 --- a/ext/ldap/tests/ldap_count_entries_basic.phpt +++ b/ext/ldap/tests/ldap_count_entries_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=person)"); var_dump(ldap_count_entries($link, $result)); ?> ===DONE=== @@ -21,7 +21,7 @@ var_dump(ldap_count_entries($link, $result)); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- int(3) diff --git a/ext/ldap/tests/ldap_delete_basic.phpt b/ext/ldap/tests/ldap_delete_basic.phpt index 1457384784..17b8a22f15 100644 --- a/ext/ldap/tests/ldap_delete_basic.phpt +++ b/ext/ldap/tests/ldap_delete_basic.phpt @@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_add($link, "dc=my-domain,dc=com", array( +ldap_add($link, "dc=my-domain,$base", array( "objectClass" => array( "top", "dcObject", @@ -21,8 +21,8 @@ ldap_add($link, "dc=my-domain,dc=com", array( )); var_dump( - ldap_delete($link, "dc=my-domain,dc=com"), - @ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)") + ldap_delete($link, "dc=my-domain,$base"), + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") ); ?> ===DONE=== @@ -32,7 +32,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "$base"); ?> --EXPECT-- bool(true) diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt index 6ef997bb03..1d160f1074 100644 --- a/ext/ldap/tests/ldap_delete_error.phpt +++ b/ext/ldap/tests/ldap_delete_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_delete()); var_dump(ldap_delete($link)); // Too many parameters -var_dump(ldap_delete($link, "dc=my-domain,dc=com", "Additional data")); +var_dump(ldap_delete($link, "$base", "Additional data")); // Invalid DN var_dump( @@ -28,7 +28,7 @@ var_dump( // Deleting unexisting data var_dump( - ldap_delete($link, "dc=my-domain,dc=com"), + ldap_delete($link, "dc=my-domain,$base"), ldap_error($link), ldap_errno($link) ); diff --git a/ext/ldap/tests/ldap_errno_basic.phpt b/ext/ldap/tests/ldap_errno_basic.phpt index 4b02ac6d65..58fa9387c0 100644 --- a/ext/ldap/tests/ldap_errno_basic.phpt +++ b/ext/ldap/tests/ldap_errno_basic.phpt @@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -@ldap_add($link, "badDN dc=my-domain,dc=com", array( +@ldap_add($link, "badDN $base", array( "objectClass" => array( "top", "dcObject", diff --git a/ext/ldap/tests/ldap_error_basic.phpt b/ext/ldap/tests/ldap_error_basic.phpt index 64e4ef6170..ba42d1d32e 100644 --- a/ext/ldap/tests/ldap_error_basic.phpt +++ b/ext/ldap/tests/ldap_error_basic.phpt @@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -@ldap_add($link, "badDN dc=my-domain,dc=com", array( +@ldap_add($link, "badDN $base", array( "objectClass" => array( "top", "dcObject", diff --git a/ext/ldap/tests/ldap_first_attribute_basic.phpt b/ext/ldap/tests/ldap_first_attribute_basic.phpt index 8e506fae8f..eec67c5f90 100644 --- a/ext/ldap/tests/ldap_first_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_first_attribute_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=organization)", array("objectClass")); $entry = ldap_first_entry($link, $result); var_dump( ldap_first_attribute($link, $entry) @@ -24,7 +24,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- string(11) "objectClass" diff --git a/ext/ldap/tests/ldap_first_entry_basic.phpt b/ext/ldap/tests/ldap_first_entry_basic.phpt index 9b658227e7..5ba6ac42a4 100644 --- a/ext/ldap/tests/ldap_first_entry_basic.phpt +++ b/ext/ldap/tests/ldap_first_entry_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=person)"); var_dump( $entry = ldap_first_entry($link, $result), ldap_get_values($link, $entry, 'sn') @@ -24,7 +24,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result entry) diff --git a/ext/ldap/tests/ldap_first_reference_basic.phpt b/ext/ldap/tests/ldap_first_reference_basic.phpt index d7834896a2..37155a796c 100644 --- a/ext/ldap/tests/ldap_first_reference_basic.phpt +++ b/ext/ldap/tests/ldap_first_reference_basic.phpt @@ -10,14 +10,14 @@ Patrick Allaert <patrickallaert@php.net> <?php require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userref,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userref,$base", array( "objectClass" => array("extensibleObject", "referral"), "cn" => "userref", - "ref" => "cn=userA,dc=my-domain,dc=com", + "ref" => "cn=userA,$base", )); ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); -$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)"); +$result = ldap_search($link, "$base", "(cn=*)"); var_dump($ref = ldap_first_reference($link, $result)); $refs = null; ldap_parse_reference($link, $ref, $refs); @@ -31,13 +31,13 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userref,$base"); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result entry) array(1) { [0]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } ===DONE=== diff --git a/ext/ldap/tests/ldap_free_result_basic.phpt b/ext/ldap/tests/ldap_free_result_basic.phpt index 33e47d6eae..ff2f5402c3 100644 --- a/ext/ldap/tests/ldap_free_result_basic.phpt +++ b/ext/ldap/tests/ldap_free_result_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=person)"); var_dump(ldap_free_result($result)); ?> ===DONE=== @@ -21,7 +21,7 @@ var_dump(ldap_free_result($result)); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- bool(true) diff --git a/ext/ldap/tests/ldap_get_attributes_basic.phpt b/ext/ldap/tests/ldap_get_attributes_basic.phpt index 82074c592a..c380432d1b 100644 --- a/ext/ldap/tests/ldap_get_attributes_basic.phpt +++ b/ext/ldap/tests/ldap_get_attributes_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( ldap_get_attributes($link, $entry) @@ -24,42 +24,31 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- -array(7) { +--EXPECTF-- +array(5) { ["objectClass"]=> - array(4) { + array(3) { ["count"]=> - int(3) + int(2) [0]=> string(3) "top" [1]=> - string(8) "dcObject" - [2]=> string(12) "organization" } [0]=> string(11) "objectClass" - ["dc"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(9) "my-domain" - } - [1]=> - string(2) "dc" ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } - [2]=> + [1]=> string(1) "o" ["count"]=> - int(3) + int(2) } ===DONE=== diff --git a/ext/ldap/tests/ldap_get_dn_basic.phpt b/ext/ldap/tests/ldap_get_dn_basic.phpt index e70e7bf6c5..38c252c5bb 100644 --- a/ext/ldap/tests/ldap_get_dn_basic.phpt +++ b/ext/ldap/tests/ldap_get_dn_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( ldap_get_dn($link, $entry) @@ -24,8 +24,8 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- -string(19) "dc=my-domain,dc=com" +--EXPECTF-- +string(%d) "%s" ===DONE=== diff --git a/ext/ldap/tests/ldap_get_entries_basic.phpt b/ext/ldap/tests/ldap_get_entries_basic.phpt index 90dbb26146..8ed479ee4c 100644 --- a/ext/ldap/tests/ldap_get_entries_basic.phpt +++ b/ext/ldap/tests/ldap_get_entries_basic.phpt @@ -11,12 +11,12 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)") + ldap_search($link, "$base", "(o=test)") ) ); ?> @@ -26,49 +26,38 @@ var_dump( require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- array(2) { ["count"]=> int(1) [0]=> - array(8) { + array(6) { ["objectclass"]=> - array(4) { + array(3) { ["count"]=> - int(3) + int(2) [0]=> string(3) "top" [1]=> - string(8) "dcObject" - [2]=> string(12) "organization" } [0]=> string(11) "objectclass" - ["dc"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(9) "my-domain" - } - [1]=> - string(2) "dc" ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } - [2]=> + [1]=> string(1) "o" ["count"]=> - int(3) + int(2) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(23) "o=test,dc=mcmic,dc=test" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_get_entries_variation.phpt b/ext/ldap/tests/ldap_get_entries_variation.phpt index cb0f306d5c..87d155a94c 100644 --- a/ext/ldap/tests/ldap_get_entries_variation.phpt +++ b/ext/ldap/tests/ldap_get_entries_variation.phpt @@ -11,12 +11,12 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(o=my-unexisting-domain)") + ldap_search($link, "$base", "(o=my-unexisting-domain)") ) ); ?> @@ -26,7 +26,7 @@ var_dump( require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- array(1) { diff --git a/ext/ldap/tests/ldap_get_values_len_basic.phpt b/ext/ldap/tests/ldap_get_values_len_basic.phpt index ed8461427b..33084f48ab 100644 --- a/ext/ldap/tests/ldap_get_values_len_basic.phpt +++ b/ext/ldap/tests/ldap_get_values_len_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( ldap_get_values_len($link, $entry, "o") @@ -24,12 +24,12 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- array(2) { [0]=> - string(9) "my-domain" + string(4) "test" ["count"]=> int(1) } diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt index 45f9031df4..8bcaee070f 100644 --- a/ext/ldap/tests/ldap_get_values_len_error.phpt +++ b/ext/ldap/tests/ldap_get_values_len_error.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); // Too few parameters @@ -28,7 +28,7 @@ var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute")); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- Warning: ldap_get_values_len() expects exactly 3 parameters, 1 given in %s on line %d diff --git a/ext/ldap/tests/ldap_list_basic.phpt b/ext/ldap/tests/ldap_list_basic.phpt index 1993f30f1f..3f98bc8e2d 100644 --- a/ext/ldap/tests/ldap_list_basic.phpt +++ b/ext/ldap/tests/ldap_list_basic.phpt @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - $result = ldap_list($link, "dc=my-domain,dc=com", "(objectClass=person)"), + $result = ldap_list($link, "$base", "(objectClass=person)"), ldap_get_entries($link, $result) ); ?> @@ -26,7 +26,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -92,7 +92,7 @@ array(3) { ["count"]=> int(6) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(12) { @@ -144,7 +144,7 @@ array(3) { ["count"]=> int(5) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_list_error.phpt b/ext/ldap/tests/ldap_list_error.phpt index d234d0aa3b..51bcaa583f 100644 --- a/ext/ldap/tests/ldap_list_error.phpt +++ b/ext/ldap/tests/ldap_list_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_list($link)); var_dump(ldap_list($link, $link)); // Too many parameters -var_dump(ldap_list($link, "dc=my-domain,dc=com", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); +var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); ?> ===DONE=== --EXPECTF-- diff --git a/ext/ldap/tests/ldap_mod_add_basic.phpt b/ext/ldap/tests/ldap_mod_add_basic.phpt index 8c8164cfa1..a05a6a0418 100644 --- a/ext/ldap/tests/ldap_mod_add_basic.phpt +++ b/ext/ldap/tests/ldap_mod_add_basic.phpt @@ -11,17 +11,17 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); $entry = array( "description" => "Domain description", ); var_dump( - ldap_mod_add($link, "dc=my-domain,dc=com", $entry), + ldap_mod_add($link, "o=test,$base", $entry), ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(Description=Domain description)") + ldap_search($link, "o=test,$base", "(Description=Domain description)") ) ); ?> @@ -32,45 +32,34 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> int(1) [0]=> - array(10) { + array(8) { ["objectclass"]=> - array(4) { + array(3) { ["count"]=> - int(3) + int(2) [0]=> string(3) "top" [1]=> - string(8) "dcObject" - [2]=> string(12) "organization" } [0]=> string(11) "objectclass" - ["dc"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(9) "my-domain" - } - [1]=> - string(2) "dc" ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } - [2]=> + [1]=> string(1) "o" ["description"]=> array(2) { @@ -79,12 +68,12 @@ array(2) { [0]=> string(18) "Domain description" } - [3]=> + [2]=> string(11) "description" ["count"]=> - int(4) + int(3) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(%d) "o=test,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt index 4ba1ef9bb3..c04e2cbd3d 100644 --- a/ext/ldap/tests/ldap_mod_add_error.phpt +++ b/ext/ldap/tests/ldap_mod_add_error.phpt @@ -15,13 +15,13 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Too few parameters var_dump(ldap_mod_add()); var_dump(ldap_mod_add($link)); -var_dump(ldap_mod_add($link, "dc=my-domain,dc=com")); +var_dump(ldap_mod_add($link, "$base")); // Too many parameters -var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", array(), "Additional data")); +var_dump(ldap_mod_add($link, "$base", array(), "Additional data")); // DN not found -var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", array())); +var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); // Invalid DN var_dump(ldap_mod_add($link, "weirdAttribute=val", array())); @@ -35,17 +35,17 @@ $entry = array( "o" => "my-domain", ); -ldap_add($link, "dc=my-domain,dc=com", $entry); +ldap_add($link, "dc=my-domain,$base", $entry); $entry2 = $entry; $entry2["dc"] = "Wrong Domain"; -var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", $entry2)); +var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2)); $entry2 = $entry; $entry2["weirdAttribute"] = "weirdVal"; -var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", $entry2)); +var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2)); ?> ===DONE=== --CLEAN-- @@ -54,7 +54,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- Warning: ldap_mod_add() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_mod_del_basic.phpt b/ext/ldap/tests/ldap_mod_del_basic.phpt index c7daba44de..788ac0adb3 100644 --- a/ext/ldap/tests/ldap_mod_del_basic.phpt +++ b/ext/ldap/tests/ldap_mod_del_basic.phpt @@ -11,17 +11,17 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); $entry = array( "description" => "user A" ); var_dump( - ldap_mod_del($link, "cn=userA,dc=my-domain,dc=com", $entry), + ldap_mod_del($link, "cn=userA,$base", $entry), ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(description=user A)") + ldap_search($link, "$base", "(description=user A)") ) ); ?> @@ -32,7 +32,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECT-- bool(true) diff --git a/ext/ldap/tests/ldap_mod_del_error.phpt b/ext/ldap/tests/ldap_mod_del_error.phpt index 71bac9f28c..679adb6e6e 100644 --- a/ext/ldap/tests/ldap_mod_del_error.phpt +++ b/ext/ldap/tests/ldap_mod_del_error.phpt @@ -15,19 +15,19 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Too few parameters var_dump(ldap_mod_del()); var_dump(ldap_mod_del($link)); -var_dump(ldap_mod_del($link, "dc=my-domain,dc=com")); +var_dump(ldap_mod_del($link, "$base")); // Too many parameters -var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array(), "Additional data")); +var_dump(ldap_mod_del($link, "$base", array(), "Additional data")); // DN not found -var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array())); +var_dump(ldap_mod_del($link, "dc=my-domain,$base", array())); // Invalid DN var_dump(ldap_mod_del($link, "weirdAttribute=val", array())); // Invalid attributes -var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array('dc'))); +var_dump(ldap_mod_del($link, "$base", array('dc'))); ?> ===DONE=== --CLEAN-- @@ -36,7 +36,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- Warning: ldap_mod_del() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_mod_replace_basic.phpt b/ext/ldap/tests/ldap_mod_replace_basic.phpt index d1670ec02b..8e9fd4dcad 100644 --- a/ext/ldap/tests/ldap_mod_replace_basic.phpt +++ b/ext/ldap/tests/ldap_mod_replace_basic.phpt @@ -11,17 +11,17 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); $entry = array( "description" => "user X" ); var_dump( - ldap_mod_replace($link, "cn=userA,dc=my-domain,dc=com", $entry), + ldap_mod_replace($link, "cn=userA,$base", $entry), ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(description=user X)", array("description")) + ldap_search($link, "$base", "(description=user X)", array("description")) ) ); ?> @@ -32,9 +32,9 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> @@ -53,7 +53,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_mod_replace_error.phpt b/ext/ldap/tests/ldap_mod_replace_error.phpt index 0409e3e386..f796568d07 100644 --- a/ext/ldap/tests/ldap_mod_replace_error.phpt +++ b/ext/ldap/tests/ldap_mod_replace_error.phpt @@ -15,19 +15,19 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Too few parameters var_dump(ldap_mod_replace()); var_dump(ldap_mod_replace($link)); -var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com")); +var_dump(ldap_mod_replace($link, "$base")); // Too many parameters -var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array(), "Additional data")); +var_dump(ldap_mod_replace($link, "$base", array(), "Additional data")); // DN not found -var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array())); +var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array())); // Invalid DN var_dump(ldap_mod_replace($link, "weirdAttribute=val", array())); // Invalid attributes -var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array('dc'))); +var_dump(ldap_mod_replace($link, "$base", array('dc'))); ?> ===DONE=== --CLEAN-- @@ -35,8 +35,6 @@ var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array('dc'))); require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); - -ldap_delete($link, "dc=my-domain,dc=com"); ?> --EXPECTF-- Warning: ldap_mod_replace() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_modify_basic.phpt b/ext/ldap/tests/ldap_modify_basic.phpt index 74bd831291..2f6a51af4d 100644 --- a/ext/ldap/tests/ldap_modify_basic.phpt +++ b/ext/ldap/tests/ldap_modify_basic.phpt @@ -11,23 +11,21 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); $entry = array( "objectClass" => array( "top", - "dcObject", "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "o" => "test", "description" => "Domain description", ); var_dump( - ldap_modify($link, "dc=my-domain,dc=com", $entry), + ldap_modify($link, "o=test,$base", $entry), ldap_get_entries( $link, - ldap_search($link, "dc=my-domain,dc=com", "(Description=Domain description)") + ldap_search($link, "$base", "(Description=Domain description)") ) ); ?> @@ -38,45 +36,34 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> int(1) [0]=> - array(10) { + array(8) { ["objectclass"]=> - array(4) { + array(3) { ["count"]=> - int(3) + int(2) [0]=> string(3) "top" [1]=> - string(8) "dcObject" - [2]=> string(12) "organization" } [0]=> string(11) "objectclass" - ["dc"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(9) "my-domain" - } - [1]=> - string(2) "dc" ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } - [2]=> + [1]=> string(1) "o" ["description"]=> array(2) { @@ -85,12 +72,12 @@ array(2) { [0]=> string(18) "Domain description" } - [3]=> + [2]=> string(11) "description" ["count"]=> - int(4) + int(3) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(%d) "o=test,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_modify_batch_basic.phpt b/ext/ldap/tests/ldap_modify_batch_basic.phpt index 4f6705c7e8..23700b49b2 100644 --- a/ext/ldap/tests/ldap_modify_batch_basic.phpt +++ b/ext/ldap/tests/ldap_modify_batch_basic.phpt @@ -11,7 +11,7 @@ Ondřej Hošek <ondra.hosek@gmail.com> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); $mods = array( array( @@ -33,8 +33,8 @@ $mods = array( ); var_dump( - ldap_modify_batch($link, "cn=userA,dc=my-domain,dc=com", $mods), - ldap_get_entries($link, ldap_search($link, "dc=my-domain,dc=com", "(sn=Brown-Smith)")) + ldap_modify_batch($link, "cn=userA,$base", $mods), + ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) ); ?> ===DONE=== @@ -44,9 +44,9 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> @@ -103,7 +103,7 @@ array(2) { ["count"]=> int(5) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt index 687c371c4d..2d72d491f8 100644 --- a/ext/ldap/tests/ldap_modify_batch_error.phpt +++ b/ext/ldap/tests/ldap_modify_batch_error.phpt @@ -23,13 +23,13 @@ $addGivenName = array( // Too few parameters var_dump(ldap_modify_batch()); var_dump(ldap_modify_batch($link)); -var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com")); +var_dump(ldap_modify_batch($link, "$base")); // Too many parameters -var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName, "Invalid additional parameter")); +var_dump(ldap_modify_batch($link, "$base", $addGivenName, "Invalid additional parameter")); // DN not found -var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName)); +var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName)); // Invalid DN var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName)); @@ -44,7 +44,7 @@ $entry = array( "o" => "my-domain", ); -ldap_add($link, "dc=my-domain,dc=com", $entry); +ldap_add($link, "dc=my-domain,$base", $entry); // invalid domain $mods = array( @@ -55,7 +55,7 @@ $mods = array( ) ); -var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods)); +var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); // invalid attribute $mods = array( @@ -66,7 +66,7 @@ $mods = array( ) ); -var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods)); +var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); ?> ===DONE=== --CLEAN-- @@ -75,7 +75,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- Warning: ldap_modify_batch() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt index 78a7212182..0ca2ea49dc 100644 --- a/ext/ldap/tests/ldap_modify_error.phpt +++ b/ext/ldap/tests/ldap_modify_error.phpt @@ -15,13 +15,13 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Too few parameters var_dump(ldap_modify()); var_dump(ldap_modify($link)); -var_dump(ldap_modify($link, "dc=my-domain,dc=com")); +var_dump(ldap_modify($link, "$base")); // Too many parameters -var_dump(ldap_modify($link, "dc=my-domain,dc=com", array(), "Additional data")); +var_dump(ldap_modify($link, "$base", array(), "Additional data")); // DN not found -var_dump(ldap_modify($link, "dc=my-domain,dc=com", array())); +var_dump(ldap_modify($link, "cn=not-found,$base", array())); // Invalid DN var_dump(ldap_modify($link, "weirdAttribute=val", array())); @@ -35,17 +35,17 @@ $entry = array( "o" => "my-domain", ); -ldap_add($link, "dc=my-domain,dc=com", $entry); +ldap_add($link, "dc=my-domain,$base", $entry); $entry2 = $entry; $entry2["dc"] = "Wrong Domain"; -var_dump(ldap_modify($link, "dc=my-domain,dc=com", $entry2)); +var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2)); $entry2 = $entry; $entry2["weirdAttribute"] = "weirdVal"; -var_dump(ldap_modify($link, "dc=my-domain,dc=com", $entry2)); +var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2)); ?> ===DONE=== --CLEAN-- @@ -54,7 +54,7 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "dc=my-domain,dc=com"); +ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- Warning: ldap_modify() expects exactly 3 parameters, 0 given in %s on line %d diff --git a/ext/ldap/tests/ldap_next_attribute_basic.phpt b/ext/ldap/tests/ldap_next_attribute_basic.phpt index 0fab78a70c..1acc0e1ad1 100644 --- a/ext/ldap/tests/ldap_next_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_next_attribute_basic.phpt @@ -11,13 +11,14 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(cn=userC)"); $entry = ldap_first_entry($link, $result); $attribute = ldap_first_attribute($link, $entry); var_dump( ldap_next_attribute($link, $entry), ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry), ldap_next_attribute($link, $entry) ); ?> @@ -27,10 +28,11 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- string(%d) "%s" string(%d) "%s" +string(%d) "%s" bool(false) ===DONE=== diff --git a/ext/ldap/tests/ldap_next_attribute_error.phpt b/ext/ldap/tests/ldap_next_attribute_error.phpt index c58a5602a6..0bedf8c33f 100644 --- a/ext/ldap/tests/ldap_next_attribute_error.phpt +++ b/ext/ldap/tests/ldap_next_attribute_error.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)"); +insert_dummy_data($link, $base); +$result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( ldap_next_attribute($link), @@ -26,7 +26,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- Warning: ldap_next_attribute() expects %s 2 parameters, 1 given in %s on line %d diff --git a/ext/ldap/tests/ldap_next_entry_basic.phpt b/ext/ldap/tests/ldap_next_entry_basic.phpt index 3209df6a01..dd43715239 100644 --- a/ext/ldap/tests/ldap_next_entry_basic.phpt +++ b/ext/ldap/tests/ldap_next_entry_basic.phpt @@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -$result = ldap_list($link, "dc=my-domain,dc=com", "(objectClass=person)"); +insert_dummy_data($link, $base); +$result = ldap_list($link, "$base", "(objectClass=person)"); $entry = ldap_first_entry($link, $result); var_dump( $entry = ldap_next_entry($link, $entry), @@ -26,7 +26,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result entry) diff --git a/ext/ldap/tests/ldap_next_reference_basic.phpt b/ext/ldap/tests/ldap_next_reference_basic.phpt index d0fa31d9cb..18b135da01 100644 --- a/ext/ldap/tests/ldap_next_reference_basic.phpt +++ b/ext/ldap/tests/ldap_next_reference_basic.phpt @@ -10,19 +10,19 @@ Patrick Allaert <patrickallaert@php.net> <?php require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userref,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userref,$base", array( "objectClass" => array("extensibleObject", "referral"), "cn" => "userref", - "ref" => "cn=userA,dc=my-domain,dc=com", + "ref" => "cn=userA,$base", )); -ldap_add($link, "cn=userref2,dc=my-domain,dc=com", array( +ldap_add($link, "cn=userref2,$base", array( "objectClass" => array("extensibleObject", "referral"), "cn" => "userref2", - "ref" => "cn=userB,dc=my-domain,dc=com", + "ref" => "cn=userB,$base", )); ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); -$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)"); +$result = ldap_search($link, "$base", "(cn=*)"); $ref = ldap_first_reference($link, $result); var_dump($ref2 = ldap_next_reference($link, $ref)); ldap_parse_reference($link, $ref2, $refs); @@ -36,14 +36,14 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,dc=my-domain,dc=com"); -ldap_delete($link, "cn=userref2,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userref,$base"); +ldap_delete($link, "cn=userref2,$base"); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result entry) array(1) { [0]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } ===DONE=== diff --git a/ext/ldap/tests/ldap_parse_reference_basic.phpt b/ext/ldap/tests/ldap_parse_reference_basic.phpt index 2bacd428a2..249f2959f3 100644 --- a/ext/ldap/tests/ldap_parse_reference_basic.phpt +++ b/ext/ldap/tests/ldap_parse_reference_basic.phpt @@ -10,14 +10,14 @@ Patrick Allaert <patrickallaert@php.net> <?php require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userref,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userref,$base", array( "objectClass" => array("extensibleObject", "referral"), "cn" => "userref", - "ref" => "cn=userA,dc=my-domain,dc=com", + "ref" => "cn=userA,$base", )); ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); -$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)"); +$result = ldap_search($link, "$base", "(cn=*)"); $ref = ldap_first_reference($link, $result); $refs = null; var_dump( @@ -33,13 +33,13 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userref,$base"); +remove_dummy_data($link, $base); ?> --EXPECTF-- bool(true) array(1) { [0]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } ===DONE=== diff --git a/ext/ldap/tests/ldap_parse_result_basic.phpt b/ext/ldap/tests/ldap_parse_result_basic.phpt index 1646d59c91..ec88dff377 100644 --- a/ext/ldap/tests/ldap_parse_result_basic.phpt +++ b/ext/ldap/tests/ldap_parse_result_basic.phpt @@ -11,13 +11,13 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userref,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userref,$base", array( "objectClass" => array("extensibleObject", "referral"), "cn" => "userref", - "ref" => "cn=userA,dc=my-domain,dc=com", + "ref" => "cn=userA,$base", )); -$result = ldap_search($link, "cn=userref,dc=my-domain,dc=com", "(cn=user*)"); +$result = ldap_search($link, "cn=userref,$base", "(cn=user*)"); $errcode = $dn = $errmsg = $refs = null; var_dump( ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs), @@ -32,16 +32,16 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userref,$base"); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) int(10) -string(30) "cn=userref,dc=my-domain,dc=com" +string(%d) "cn=userref,%s" string(0) "" array(1) { [0]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } ===DONE=== diff --git a/ext/ldap/tests/ldap_read_basic.phpt b/ext/ldap/tests/ldap_read_basic.phpt index 04d03d9860..5a6e7ed057 100644 --- a/ext/ldap/tests/ldap_read_basic.phpt +++ b/ext/ldap/tests/ldap_read_basic.phpt @@ -5,8 +5,8 @@ Davide Mendolia <idaf1er@gmail.com> Patrick Allaert <patrickallaert@php.net> Belgian PHP Testfest 2009 --SKIPIF-- -<?php -require_once('skipif.inc'); +<?php +require_once('skipif.inc'); require_once('skipifbindfailure.inc'); ?> --FILE-- @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - $result = ldap_read($link, "dc=my-domain,dc=com", "(dc=*)"), + $result = ldap_read($link, "o=test,$base", "(o=*)"), ldap_get_entries($link, $result) ); ?> @@ -26,7 +26,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -34,42 +34,31 @@ array(2) { ["count"]=> int(1) [0]=> - array(8) { + array(6) { ["objectclass"]=> - array(4) { + array(3) { ["count"]=> - int(3) + int(2) [0]=> string(3) "top" [1]=> - string(8) "dcObject" - [2]=> string(12) "organization" } [0]=> string(11) "objectclass" - ["dc"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(9) "my-domain" - } - [1]=> - string(2) "dc" ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } - [2]=> + [1]=> string(1) "o" ["count"]=> - int(3) + int(2) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(%d) "o=test,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_read_error.phpt b/ext/ldap/tests/ldap_read_error.phpt index 649658aa71..7d57172e0d 100644 --- a/ext/ldap/tests/ldap_read_error.phpt +++ b/ext/ldap/tests/ldap_read_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_read($link)); var_dump(ldap_read($link, $link)); // Too many parameters -var_dump(ldap_read($link, "dc=my-domain,dc=com", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); +var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); ?> ===DONE=== --EXPECTF-- diff --git a/ext/ldap/tests/ldap_rename_basic.phpt b/ext/ldap/tests/ldap_rename_basic.phpt index 135769d1d4..c01c4318a6 100644 --- a/ext/ldap/tests/ldap_rename_basic.phpt +++ b/ext/ldap/tests/ldap_rename_basic.phpt @@ -11,12 +11,12 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - ldap_rename($link, "cn=userA,dc=my-domain,dc=com", "cn=userZ", "dc=my-domain,dc=com", true) + ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true) ); -$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userA)", array("cn", "sn")); -$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userZ)", array("cn", "sn")); +$result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn")); +$result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn")); var_dump(ldap_get_entries($link, $result)); ?> ===DONE=== @@ -25,10 +25,10 @@ var_dump(ldap_get_entries($link, $result)); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_rename($link, "cn=userZ,dc=my-domain,dc=com", "cn=userA", "dc=my-domain,dc=com", true); -remove_dummy_data($link); +ldap_rename($link, "cn=userZ,$base", "cn=userA", "$base", true); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(2) { ["count"]=> @@ -56,7 +56,7 @@ array(2) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userZ,dc=my-domain,dc=com" + string(%d) "cn=userZ,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_rename_error.phpt b/ext/ldap/tests/ldap_rename_error.phpt index 57ca3571b7..111717f0b0 100644 --- a/ext/ldap/tests/ldap_rename_error.phpt +++ b/ext/ldap/tests/ldap_rename_error.phpt @@ -11,7 +11,7 @@ require "connect.inc"; $link = ldap_connect($host, $port); var_dump(ldap_rename($link)); -var_dump(ldap_rename($link, "cn=userNotFound,dc=my-domain,dc=com", "cn=userZ", "dc=my-domain,dc=com", true)); +var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true)); ?> ===DONE=== --EXPECTF-- diff --git a/ext/ldap/tests/ldap_search_basic.phpt b/ext/ldap/tests/ldap_search_basic.phpt index e6cebf2c57..54523de38a 100644 --- a/ext/ldap/tests/ldap_search_basic.phpt +++ b/ext/ldap/tests/ldap_search_basic.phpt @@ -15,9 +15,9 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "dc=my-domain,dc=com", "(objectClass=person)"), + $result = ldap_search($link, "$base", "(objectClass=person)"), ldap_get_entries($link, $result) ); ?> @@ -27,7 +27,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -93,7 +93,7 @@ array(4) { ["count"]=> int(6) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(12) { @@ -145,7 +145,7 @@ array(4) { ["count"]=> int(5) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(10) { @@ -188,7 +188,7 @@ array(4) { ["count"]=> int(4) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_error.phpt b/ext/ldap/tests/ldap_search_error.phpt index 7e94613439..c5239e1ab1 100644 --- a/ext/ldap/tests/ldap_search_error.phpt +++ b/ext/ldap/tests/ldap_search_error.phpt @@ -12,7 +12,7 @@ include "connect.inc"; $link = ldap_connect($host, $port); -$dn = "dc=my-domain,dc=com"; +$dn = "dc=not-found,$base"; $filter = "(dc=*)"; $result = ldap_search(); diff --git a/ext/ldap/tests/ldap_search_variation1.phpt b/ext/ldap/tests/ldap_search_variation1.phpt index d56f5bdc93..766efa7598 100644 --- a/ext/ldap/tests/ldap_search_variation1.phpt +++ b/ext/ldap/tests/ldap_search_variation1.phpt @@ -14,12 +14,12 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(dc=*)"; var_dump( - $result = ldap_search($link, "dc=my-domain,dc=com", "(dc=*)", array('dc')), + $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')), ldap_get_entries($link, $result) ); ?> @@ -29,7 +29,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -38,19 +38,19 @@ array(2) { int(1) [0]=> array(4) { - ["dc"]=> + ["o"]=> array(2) { ["count"]=> int(1) [0]=> - string(9) "my-domain" + string(4) "test" } [0]=> - string(2) "dc" + string(1) "o" ["count"]=> int(1) ["dn"]=> - string(19) "dc=my-domain,dc=com" + string(%d) "o=test,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation2.phpt b/ext/ldap/tests/ldap_search_variation2.phpt index 791c5e9bcf..f2ad3a6929 100644 --- a/ext/ldap/tests/ldap_search_variation2.phpt +++ b/ext/ldap/tests/ldap_search_variation2.phpt @@ -14,10 +14,10 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array('sn'), 1), + $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1), ldap_get_entries($link, $result) ); ?> @@ -27,7 +27,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -46,7 +46,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -60,7 +60,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(4) { @@ -74,7 +74,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation3.phpt b/ext/ldap/tests/ldap_search_variation3.phpt index ab7b222825..12224de24d 100644 --- a/ext/ldap/tests/ldap_search_variation3.phpt +++ b/ext/ldap/tests/ldap_search_variation3.phpt @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(objectclass=person)"; var_dump( $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3), @@ -34,7 +34,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- resource(%d) of type (ldap result) @@ -53,7 +53,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(4) { @@ -67,7 +67,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(4) { @@ -81,7 +81,7 @@ array(4) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } @@ -102,7 +102,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation4.phpt b/ext/ldap/tests/ldap_search_variation4.phpt index 787468e0f5..ce164763b9 100644 --- a/ext/ldap/tests/ldap_search_variation4.phpt +++ b/ext/ldap/tests/ldap_search_variation4.phpt @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(objectclass=person)"; var_dump( $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3), @@ -29,7 +29,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d @@ -49,7 +49,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation5.phpt b/ext/ldap/tests/ldap_search_variation5.phpt index d50854c658..de4d405090 100644 --- a/ext/ldap/tests/ldap_search_variation5.phpt +++ b/ext/ldap/tests/ldap_search_variation5.phpt @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(objectclass=person)"; var_dump( $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING), @@ -37,7 +37,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d @@ -57,7 +57,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } @@ -78,7 +78,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } @@ -99,7 +99,7 @@ array(2) { ["count"]=> int(1) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt index 5139ebb77d..f4f98db873 100644 --- a/ext/ldap/tests/ldap_search_variation6.phpt +++ b/ext/ldap/tests/ldap_search_variation6.phpt @@ -14,9 +14,9 @@ require_once('skipifbindfailure.inc'); include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); +insert_dummy_data($link, $base); -$dn = "dc=my-domain,dc=com"; +$dn = "$base"; $filter = "(objectclass=person)"; var_dump( @@ -41,7 +41,7 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -remove_dummy_data($link); +remove_dummy_data($link, $base); ?> --EXPECTF-- array(2) { @@ -112,7 +112,7 @@ array(4) { ["count"]=> int(6) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [1]=> array(12) { @@ -164,7 +164,7 @@ array(4) { ["count"]=> int(5) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [2]=> array(10) { @@ -207,7 +207,7 @@ array(4) { ["count"]=> int(4) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } } bool(true) diff --git a/ext/ldap/tests/ldap_sort_basic.phpt b/ext/ldap/tests/ldap_sort_basic.phpt index f6ee5d198f..9744468438 100644 --- a/ext/ldap/tests/ldap_sort_basic.phpt +++ b/ext/ldap/tests/ldap_sort_basic.phpt @@ -11,29 +11,29 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userC,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userC,$base", array( "objectclass" => "person", "cn" => "userC", "sn" => "zzz", "userPassword" => "oops", "description" => "a user", )); -ldap_add($link, "cn=userD,dc=my-domain,dc=com", array( +ldap_add($link, "cn=userD,$base", array( "objectclass" => "person", "cn" => "userD", "sn" => "aaa", "userPassword" => "oops", "description" => "another user", )); -ldap_add($link, "cn=userE,dc=my-domain,dc=com", array( +ldap_add($link, "cn=userE,$base", array( "objectclass" => "person", "cn" => "userE", "sn" => "a", "userPassword" => "oops", "description" => "yet another user", )); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array("sn", "description")); +$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); var_dump( ldap_sort($link, $result, "sn"), ldap_get_entries($link, $result) @@ -45,12 +45,12 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,dc=my-domain,dc=com"); -ldap_delete($link, "cn=userD,dc=my-domain,dc=com"); -ldap_delete($link, "cn=userE,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userC,$base"); +ldap_delete($link, "cn=userD,$base"); +ldap_delete($link, "cn=userE,$base"); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(7) { ["count"]=> @@ -78,7 +78,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userE,dc=my-domain,dc=com" + string(%d) "cn=userE,%s" } [1]=> array(6) { @@ -103,7 +103,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userD,dc=my-domain,dc=com" + string(%d) "cn=userD,%s" } [2]=> array(6) { @@ -128,7 +128,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [3]=> array(6) { @@ -153,7 +153,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [4]=> array(4) { @@ -169,7 +169,7 @@ array(7) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } [5]=> array(6) { @@ -194,7 +194,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userC,dc=my-domain,dc=com" + string(%d) "cn=userC,%s" } } ===DONE=== diff --git a/ext/ldap/tests/ldap_sort_variation.phpt b/ext/ldap/tests/ldap_sort_variation.phpt index e1affe82fe..e8f00341c3 100644 --- a/ext/ldap/tests/ldap_sort_variation.phpt +++ b/ext/ldap/tests/ldap_sort_variation.phpt @@ -11,29 +11,29 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link); -ldap_add($link, "cn=userC,dc=my-domain,dc=com", array( +insert_dummy_data($link, $base); +ldap_add($link, "cn=userC,$base", array( "objectclass" => "person", "cn" => "userC", "sn" => "zzz", "userPassword" => "oops", "description" => "a user", )); -ldap_add($link, "cn=userD,dc=my-domain,dc=com", array( +ldap_add($link, "cn=userD,$base", array( "objectclass" => "person", "cn" => "userD", "sn" => "aaa", "userPassword" => "oops", "description" => "another user", )); -ldap_add($link, "cn=userE,dc=my-domain,dc=com", array( +ldap_add($link, "cn=userE,$base", array( "objectclass" => "person", "cn" => "userE", "sn" => "a", "userPassword" => "oops", "description" => "yet another user", )); -$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array("sn", "description")); +$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); var_dump( ldap_sort($link, $result, "description"), ldap_get_entries($link, $result) @@ -45,12 +45,12 @@ var_dump( include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,dc=my-domain,dc=com"); -ldap_delete($link, "cn=userD,dc=my-domain,dc=com"); -ldap_delete($link, "cn=userE,dc=my-domain,dc=com"); -remove_dummy_data($link); +ldap_delete($link, "cn=userC,$base"); +ldap_delete($link, "cn=userD,$base"); +ldap_delete($link, "cn=userE,$base"); +remove_dummy_data($link, $base); ?> ---EXPECT-- +--EXPECTF-- bool(true) array(7) { ["count"]=> @@ -69,7 +69,7 @@ array(7) { ["count"]=> int(1) ["dn"]=> - string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userC,cn=userB,%s" } [1]=> array(6) { @@ -94,7 +94,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userC,dc=my-domain,dc=com" + string(%d) "cn=userC,%s" } [2]=> array(6) { @@ -119,7 +119,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userD,dc=my-domain,dc=com" + string(%d) "cn=userD,%s" } [3]=> array(6) { @@ -144,7 +144,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userA,dc=my-domain,dc=com" + string(%d) "cn=userA,%s" } [4]=> array(6) { @@ -169,7 +169,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userB,dc=my-domain,dc=com" + string(%d) "cn=userB,%s" } [5]=> array(6) { @@ -194,7 +194,7 @@ array(7) { ["count"]=> int(2) ["dn"]=> - string(28) "cn=userE,dc=my-domain,dc=com" + string(%d) "cn=userE,%s" } } ===DONE=== |