1--TEST--
2spoofchecker with locale settings
3--EXTENSIONS--
4intl
5--SKIPIF--
6<?php if(!class_exists("Spoofchecker")) print 'skip'; ?>
7--FILE--
8<?php
9
10$s = new Spoofchecker();
11
12$s->setAllowedChars('[a-z]');
13var_dump($s->isSuspicious("123"));
14$s->setAllowedChars('[1-3]');
15var_dump($s->isSuspicious("123"));
16$s->setAllowedChars('[a-z]', SpoofChecker::IGNORE_SPACE | SpoofChecker::CASE_INSENSITIVE);
17var_dump($s->isSuspicious("ABC"));
18
19try {
20	$s->setAllowedChars('[a-z]', 1024);
21} catch (\ValueError $e) {
22	echo $e->getMessage() . PHP_EOL;
23}
24
25try {
26	$s->setAllowedChars("A-Z]");
27} catch (\ValueError $e) {
28	echo $e->getMessage() . PHP_EOL;
29}
30
31try {
32	$s->setAllowedChars("[A-Z");
33} catch (\ValueError $e) {
34	echo $e->getMessage();
35}
36
37?>
38--EXPECTF--
39bool(true)
40bool(false)
41bool(false)
42Spoofchecker::setAllowedChars(): Argument #2 ($patternOptions) must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|(<none> or SpoofChecker::USET_CASE_INSENSITIVE%s))
43Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern
44Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern
45