1--TEST--
2SPL: RegexIterator::setMode() error tests
3--CREDITS--
4Felix De Vliegher <felix.devliegher@gmail.com>
5--FILE--
6<?php
7
8$array = array('foo', 'bar', 'baz');
9$regexIterator = new RegexIterator(new ArrayIterator($array), "/f/");
10
11var_dump($regexIterator->getMode());
12
13try {
14    $regexIterator->setMode(7);
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17    var_dump($e->getCode());
18}
19
20?>
21--EXPECT--
22int(0)
23RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, RegexIterator::GET_MATCH, RegexIterator::ALL_MATCHES, RegexIterator::SPLIT, or RegexIterator::REPLACE
24int(0)
25