mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
24 lines
613 B
PHP
24 lines
613 B
PHP
--TEST--
|
|
SPL: RegexIterator::setMode() error tests
|
|
--CREDITS--
|
|
Felix De Vliegher <felix.devliegher@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
$array = array('foo', 'bar', 'baz');
|
|
$regexIterator = new RegexIterator(new ArrayIterator($array), "/f/");
|
|
|
|
var_dump($regexIterator->getMode());
|
|
|
|
try {
|
|
$regexIterator->setMode(7);
|
|
} catch (\ValueError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
var_dump($e->getCode());
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(0)
|
|
RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, RegexIterator::GET_MATCH, RegexIterator::ALL_MATCHES, RegexIterator::SPLIT, or RegexIterator::REPLACE
|
|
int(0)
|