php/php-src — pull request #427 by tistre (2013-09-03 12:51:51+00:00)
Title: run-tests.php: Added EXPECT_EXTERNAL, EXPECTF_EXTERNAL, EXPECTREGEX_EXTERNAL #55736

With this patch, run-tests.php can read the expected output from external files.

Instead of EXPECT, just use EXPECT_EXTERNAL and specify a file name (or EXPECTF_EXTERNAL, EXPECTREGEX_EXTERNAL). The _EXTERNAL postfix is borrowed from the FILE / FILE_EXTERNAL naming.

Reason: I often expect relatively large XML output from my tests. Having to paste it into the EXPECT section makes the .phpt file large, and the XML is easier to handle in a separate file (I can run xmllint on it). Having different character encoding in test code and expected output is also a possible use case. And with external files, I can reuse one test's expected output as the input for another test.

What do you think?

See: https://bugs.php.net/bug.php?id=55736