summaryrefslogtreecommitdiff
path: root/ext/ldap/tests
diff options
context:
space:
mode:
authorChris Wright <daverandom@php.net>2013-09-17 11:34:30 -0400
committerChris Wright <chrisw@networkm.co.uk>2013-09-18 12:18:05 +0100
commit0d534d7c5ef2405b135bf798be73ec37b770d7f3 (patch)
treef35183fc80ddc1081e397fbac7b68d06439badd5 /ext/ldap/tests
parent4a85b5e190d6651bee26bbbeff4ed09d2932f352 (diff)
downloadphp-git-0d534d7c5ef2405b135bf798be73ec37b770d7f3.tar.gz
Add ldap_escape()
Diffstat (limited to 'ext/ldap/tests')
-rw-r--r--ext/ldap/tests/ldap_escape_all.phpt14
-rw-r--r--ext/ldap/tests/ldap_escape_both.phpt14
-rw-r--r--ext/ldap/tests/ldap_escape_dn.phpt14
-rw-r--r--ext/ldap/tests/ldap_escape_filter.phpt14
-rw-r--r--ext/ldap/tests/ldap_escape_ignore.phpt15
5 files changed, 71 insertions, 0 deletions
diff --git a/ext/ldap/tests/ldap_escape_all.phpt b/ext/ldap/tests/ldap_escape_all.phpt
new file mode 100644
index 0000000000..a79be004ff
--- /dev/null
+++ b/ext/ldap/tests/ldap_escape_all.phpt
@@ -0,0 +1,14 @@
+--TEST--
+ldap_escape() test all
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$subject = 'foo=bar(baz)*';
+
+var_dump(ldap_escape($subject));
+
+?>
+--EXPECT--
+string(39) "\66\6f\6f\3d\62\61\72\28\62\61\7a\29\2a" \ No newline at end of file
diff --git a/ext/ldap/tests/ldap_escape_both.phpt b/ext/ldap/tests/ldap_escape_both.phpt
new file mode 100644
index 0000000000..2169c0ad2e
--- /dev/null
+++ b/ext/ldap/tests/ldap_escape_both.phpt
@@ -0,0 +1,14 @@
+--TEST--
+ldap_escape() test filter and DN
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$subject = 'foo=bar(baz)*';
+
+var_dump(ldap_escape($subject, null, LDAP_ESCAPE_DN | LDAP_ESCAPE_FILTER));
+
+?>
+--EXPECT--
+string(21) "foo\3dbar\28baz\29\2a" \ No newline at end of file
diff --git a/ext/ldap/tests/ldap_escape_dn.phpt b/ext/ldap/tests/ldap_escape_dn.phpt
new file mode 100644
index 0000000000..fbcb0545ae
--- /dev/null
+++ b/ext/ldap/tests/ldap_escape_dn.phpt
@@ -0,0 +1,14 @@
+--TEST--
+ldap_escape() test DN
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$subject = 'foo=bar(baz)*';
+
+var_dump(ldap_escape($subject, null, LDAP_ESCAPE_DN));
+
+?>
+--EXPECT--
+string(15) "foo\3dbar(baz)*" \ No newline at end of file
diff --git a/ext/ldap/tests/ldap_escape_filter.phpt b/ext/ldap/tests/ldap_escape_filter.phpt
new file mode 100644
index 0000000000..e4540a452d
--- /dev/null
+++ b/ext/ldap/tests/ldap_escape_filter.phpt
@@ -0,0 +1,14 @@
+--TEST--
+ldap_escape() test filter
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$subject = 'foo=bar(baz)*';
+
+var_dump(ldap_escape($subject, null, LDAP_ESCAPE_FILTER));
+
+?>
+--EXPECT--
+string(19) "foo=bar\28baz\29\2a" \ No newline at end of file
diff --git a/ext/ldap/tests/ldap_escape_ignore.phpt b/ext/ldap/tests/ldap_escape_ignore.phpt
new file mode 100644
index 0000000000..ab56aa2d0e
--- /dev/null
+++ b/ext/ldap/tests/ldap_escape_ignore.phpt
@@ -0,0 +1,15 @@
+--TEST--
+ldap_escape() test ignore
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$subject = 'foo=bar(baz)*';
+$ignore = 'ao';
+
+var_dump(ldap_escape($subject, $ignore));
+
+?>
+--EXPECT--
+string(31) "\66oo\3d\62a\72\28\62a\7a\29\2a" \ No newline at end of file