|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55736 Added EXPECT_EXTERNAL section to run-tests.php
Submitted: 2011-09-20 09:21 UTC Modified: 2013-10-09 09:42 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tim at digicol dot de Assigned: mike (profile)
Status: Closed Package: Testing related
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tim at digicol dot de
New email:
PHP Version: OS:


 [2011-09-20 09:21 UTC] tim at digicol dot de
In the .phpt files used with run-tests.php, I'd like an option to read the 
expected output from external files.

For consistency with the FILE / FILE_EXTERNAL section naming, I'd call this 

The attached patch (against run-tests.php of PHP 5.3.8) implements this 
functionality. Would you mind adding it as a standard feature?

Reason: We often expect relatively large XML output from our 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). Also, I'd like to 
reuse one test's expected output as the input for another test, which works great 
with external files.

Test script:
[digicol@dcxcentosvmware php-5.3.8]$ cat tmp.phpt 

echo pi() . "\n";


[digicol@dcxcentosvmware php-5.3.8]$ cat expected.txt 

[digicol@dcxcentosvmware php-5.3.8]$ php run-tests.php.expect_external -p `which php` tmp.phpt

PHP         : /usr/local/bin/php 
PHP_SAPI    : cli
PHP_OS      : Linux - Linux dcxcentosvmware.digicol.local 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64
INI actual  : /usr/local/lib/php.ini
More .INIs  :  
CWD         : /usr/local/src/php-5.3.8
Extra dirs  : 
VALGRIND    : Not used
Running selected tests.
PASS Demo [tmp.phpt] 
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    1 (100.0%) (100.0%)
Time taken      :    0 seconds


run-tests-expect_external (last revision 2011-09-20 09:22 UTC by tim at digicol dot de)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-20 09:31 UTC] tim at digicol dot de
-Summary: Added FILE_EXTERNAL section to run-tests.php +Summary: Added EXPECT_EXTERNAL section to run-tests.php
 [2011-09-20 09:31 UTC] tim at digicol dot de
Sorry, typo in summary. It's EXPECT_EXTERNAL, not FILE_EXTERNAL.
 [2011-09-26 22:13 UTC]
-Package: *General Issues +Package: Testing related
 [2013-10-09 09:42 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 [2013-10-09 09:42 UTC]
Merged in master as 5f41cb18beb9437df73c382b5a9689d43c357628
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 02:01:23 2021 UTC