diff options
Diffstat (limited to 'ext/spl/tests/regexiterator_getregex.phpt')
-rw-r--r-- | ext/spl/tests/regexiterator_getregex.phpt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/spl/tests/regexiterator_getregex.phpt b/ext/spl/tests/regexiterator_getregex.phpt new file mode 100644 index 0000000..d3113a5 --- /dev/null +++ b/ext/spl/tests/regexiterator_getregex.phpt @@ -0,0 +1,29 @@ +--TEST-- +SPL: RegexIterator::getRegex() basic tests +--CREDITS-- +Joshua Thijssen <jthijssen@noxlogic.nl> +--FILE-- +<?php + +$array = array('cat', 'hat', 'sat'); +$iterator = new ArrayIterator($array); + +# Simple regex +$regexIterator = new RegexIterator($iterator, '/.at/'); +var_dump($regexIterator->getRegex()); + +# Empty regular expression +$regexIterator = new RegexIterator($iterator, '//'); +var_dump($regexIterator->getRegex()); + +# "Complex" email regular expression +$regexIterator = new RegexIterator($iterator, '|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|'); +var_dump($regexIterator->getRegex()); + + + +?> +--EXPECT-- +string(5) "/.at/" +string(2) "//" +string(43) "|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|" |