Edit report at https://bugs.php.net/bug.php?id=55736&edit=1

 ID:                 55736
 Updated by:         m...@php.net
 Reported by:        tim at digicol dot de
 Summary:            Added EXPECT_EXTERNAL section to run-tests.php
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
 Package:            Testing related
 PHP Version:        5.3.8
-Assigned To:        
+Assigned To:        mike
 Block user comment: N
 Private report:     N

 New Comment:

Merged in master as 5f41cb18beb9437df73c382b5a9689d43c357628


Previous Comments:
------------------------------------------------------------------------
[2011-09-20 09:31:44] tim at digicol dot de

Sorry, typo in summary. It's EXPECT_EXTERNAL, not FILE_EXTERNAL.

------------------------------------------------------------------------
[2011-09-20 09:21:53] 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
=====================================================================



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55736&edit=1

Reply via email to