diff options
| author | Pierre Joye <pajoye@php.net> | 2010-06-15 19:47:28 +0000 |
|---|---|---|
| committer | Pierre Joye <pajoye@php.net> | 2010-06-15 19:47:28 +0000 |
| commit | 79baca329bc47b7ffeea9ac3d1838f2e387ec0ae (patch) | |
| tree | 41787b20af2e70aeac42b024aae4fec0cccf2647 /ext/ldap/tests | |
| parent | 05da8ecfadba755c525711e33cef78d9e218aac4 (diff) | |
| download | php-git-79baca329bc47b7ffeea9ac3d1838f2e387ec0ae.tar.gz | |
- #42060, add paged results support
Diffstat (limited to 'ext/ldap/tests')
3 files changed, 228 insertions, 0 deletions
diff --git a/ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt b/ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt new file mode 100644 index 0000000000..88879d974c --- /dev/null +++ b/ext/ldap/tests/ldap_ctrl_paged_results_variation1.phpt @@ -0,0 +1,56 @@ +--TEST-- +ldap_ldap_ctrl_paged_results() test (fetching the first page) +--CREDITS-- +Jean-Sebastien Hedde <jeanseb@au-fil-du.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); + +$dn = "dc=my-domain,dc=com"; +$filter = "(cn=*)"; +var_dump( + ldap_ctrl_paged_results($link, 1), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) +); +?> +===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link); +?> +--EXPECTF-- +bool(true) +resource(6) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(28) "cn=userA,dc=my-domain,dc=com" + } +} +===DONE=== diff --git a/ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt b/ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt new file mode 100644 index 0000000000..7be5a2c2f7 --- /dev/null +++ b/ext/ldap/tests/ldap_ctrl_paged_results_variation2.phpt @@ -0,0 +1,72 @@ +--TEST-- +ldap_ldap_ctrl_paged_results() test (fetching the first page with a pagesize=2) +--CREDITS-- +Jean-Sebastien Hedde <jeanseb@au-fil-du.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); + +$dn = "dc=my-domain,dc=com"; +$filter = "(cn=*)"; +var_dump( + ldap_ctrl_paged_results($link, 2), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) +); +?> +===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link); +?> +--EXPECTF-- +bool(true) +resource(6) of type (ldap result) +array(3) { + ["count"]=> + int(2) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(28) "cn=userA,dc=my-domain,dc=com" + } + [1]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userB" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(28) "cn=userB,dc=my-domain,dc=com" + } +} +===DONE=== diff --git a/ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt b/ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt new file mode 100644 index 0000000000..3134c2badb --- /dev/null +++ b/ext/ldap/tests/ldap_ctrl_paged_results_variation3.phpt @@ -0,0 +1,100 @@ +--TEST-- +ldap_ldap_ctrl_paged_results() test (fetching the first page then the next final page) +--CREDITS-- +Jean-Sebastien Hedde <jeanseb@au-fil-du.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); + +$dn = "dc=my-domain,dc=com"; +$filter = "(cn=*)"; +$cookie = ''; +var_dump( + ldap_ctrl_paged_results($link, 2, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result), + ldap_ctrl_paged_results_resp($link, $result, $cookie), + ldap_ctrl_paged_results($link, 20, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) +); +?> +===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link); +?> +--EXPECTF-- +bool(true) +resource(%d) of type (ldap result) +array(3) { + ["count"]=> + int(2) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(28) "cn=userA,dc=my-domain,dc=com" + } + [1]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userB" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(28) "cn=userB,dc=my-domain,dc=com" + } +} +bool(true) +bool(true) +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userC" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(37) "cn=userC,cn=userB,dc=my-domain,dc=com" + } +} +===DONE=== |
