EXPECTF substitution options
The --EXPECTF-- section uses a number of substitution tags for strings or digits that appear in test case output but which may vary between test runs. The most common example of this is to use %s and %d to match the file path and line number which are output by PHP Warnings.
The substitution tags and their meanings are summarised below
%code | Meaning |
---|---|
%e | Represents a directory separator, for example / on Linux. |
%s | One or more of anything (character or white space) except the end of line character. |
%S | Zero or more of anything (character or white space) except the end of line character. |
%a | One or more of anything (character or white space) including the end of line character. |
%A | Zero or more of anything (character or white space) including the end of line character. |
%w | Zero or more white space characters. |
%i | A signed integer value, for example +3142, -3142. |
%d | An unsigned integer value, for example 123456. |
%x | One or more hexadecimal character. That is, characters in the range 0-9, a-f, A-F. |
%f | A floating point number, for example: 3.142, -3.142, 3.142E-10, 3.142e+10. |
%c | A single character of any sort (.) |
%r...%r | Any string (...) enclosed between two %r will be treated as a regular expression |
%unicode|string% | Matches the string 'unicode' in PHP6 test output and 'string' in PHP5 test output. |
%binary_string_optional% | Matches 'Binary string' in PHP6 output, 'string' in PHP5 output. Used in PHP Warning messages. |
%unicode_string_optional% | Matches 'Unicode string' in PHP6 output, 'string' in PHP5 output. Used in PHP Warning messages. |
%u|b% | Matches a single 'u' in PHP6 test output where the PHP5 output from the same test has no character in that position. |