I'm trying to write a test for a PHPUnit extiontion I'm working on which needs a regex matcher in the expected section of the test.
The documentations of PHPT file states that there is a %r
flag which can be used to match regex in the --EXPECTF--
section of the test. You can get more details from: PHPT - Test File Layout
I tried to use it in my tests, but it always fail! So I decided to write a simple test to check the problem and the test looked like this:
--TEST--
Test the %r tag of EXPECTF in phpt
--FILE--
<?php
echo '1';
?>
--EXPECTF--
%r.%r
This test fails when I run it using pear's run-tests
command. The .diff
file contains the following:
001- %r.%r
001+ 1
It seems as if this tag doesn't get recognized by the tests runner. So I tried to find an example which uses this tag in the tests of the source of PHP. There was only one test to be found using it (inside: php-src-5.3/ext/standard/tests/network/gethostbyaddr_basic1.phpt).
I'm not sure what I'm doing wrong here... Any ideas?