1--TEST--
2str_decrement(): Invalid strings to decrement should throw a ValueError
3--FILE--
4<?php
5
6$strings = [
7    // Empty string
8    "",
9    // String increments are unaware of being "negative"
10    "-cc",
11    // Trailing whitespace
12    "Z ",
13    // Leading whitespace
14    " Z",
15    // Non-ASCII characters
16    "é",
17    "あいうえお",
18    "α",
19    "ω",
20    "Α", // Capital alpha
21    "Ω",
22    // With period
23    "foo1.txt",
24    "1f.5",
25    // With multiple period
26    "foo.1.txt",
27    "1.f.5",
28];
29
30foreach ($strings as $s) {
31    try {
32        var_dump(str_decrement($s));
33    } catch (ValueError $e) {
34        echo $e->getMessage(), PHP_EOL;
35    }
36}
37
38?>
39--EXPECT--
40str_decrement(): Argument #1 ($string) cannot be empty
41str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
42str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
43str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
44str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
45str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
46str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
47str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
48str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
49str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
50str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
51str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
52str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
53str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters
54