php.net |  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
Votes:1
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
15 - 5 = ?
Subscribe to this entry?

 
 [2011-09-20 09:21 UTC] tim at digicol dot de
Description:
------------
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 
feature EXPECT_EXTERNAL.

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 
--TEST--
Demo
--FILE--
<?php

echo pi() . "\n";

?>
--EXPECT_EXTERNAL--
expected.txt

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

[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_VERSION : 5.3.4
ZEND_VERSION: 2.3.0
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
=====================================================================


Patches

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

History

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] tyrael@php.net
-Package: *General Issues +Package: Testing related
 [2013-10-09 09:42 UTC] mike@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 [2013-10-09 09:42 UTC] mike@php.net
Merged in master as 5f41cb18beb9437df73c382b5a9689d43c357628
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC