summaryrefslogtreecommitdiff
path: root/ext/filter/tests
diff options
context:
space:
mode:
authorMartin Jansen <martin@divbyzero.net>2013-01-05 22:46:14 +0100
committerMartin Jansen <martin@divbyzero.net>2013-02-03 13:23:54 +0100
commit6186b676000f74af92b979382f605ed104b6a4bc (patch)
treed598b90b867f6a13ca5fb01c3026e06cc64dcf44 /ext/filter/tests
parent0661d03ebaab6cf1eff156a4dd203299d0385ae9 (diff)
downloadphp-git-6186b676000f74af92b979382f605ed104b6a4bc.tar.gz
Add option to specific the expected separator character.
Diffstat (limited to 'ext/filter/tests')
-rw-r--r--ext/filter/tests/055.phpt36
1 files changed, 25 insertions, 11 deletions
diff --git a/ext/filter/tests/055.phpt b/ext/filter/tests/055.phpt
index bf94f3515f..688dbb2b54 100644
--- a/ext/filter/tests/055.phpt
+++ b/ext/filter/tests/055.phpt
@@ -5,24 +5,32 @@ filter_var() and FILTER_VALIDATE_MAC
--FILE--
<?php
$values = Array(
- "01-23-45-67-89-ab",
- "01-23-45-67-89-AB",
- "01-23-45-67-89-aB",
- "01:23:45:67:89:ab",
- "01:23:45:67:89:AB",
- "01:23:45:67:89:aB",
- "01:23:45-67:89:aB",
- "xx:23:45:67:89:aB",
- "0123.4567.89ab",
+ array("01-23-45-67-89-ab", null),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "."))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))),
+ array("01-23-45-67-89-AB", null),
+ array("01-23-45-67-89-aB", null),
+ array("01:23:45:67:89:ab", null),
+ array("01:23:45:67:89:AB", null),
+ array("01:23:45:67:89:aB", null),
+ array("01:23:45-67:89:aB", null),
+ array("xx:23:45:67:89:aB", null),
+ array("0123.4567.89ab", null),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => ""))),
);
foreach ($values as $value) {
- var_dump(filter_var($value, FILTER_VALIDATE_MAC));
+ var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1]));
}
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
string(17) "01-23-45-67-89-ab"
+string(17) "01-23-45-67-89-ab"
+bool(false)
+bool(false)
string(17) "01-23-45-67-89-AB"
string(17) "01-23-45-67-89-aB"
string(17) "01:23:45:67:89:ab"
@@ -31,4 +39,10 @@ string(17) "01:23:45:67:89:aB"
bool(false)
bool(false)
string(14) "0123.4567.89ab"
+
+Warning: filter_var(): Separator must be exactly one character long in %s055.php on line %d
+bool(false)
+
+Warning: filter_var(): Separator must be exactly one character long in %s055.php on line %d
+bool(false)
Done