Help us write new tests

http://gcov.php.net


Writing tests is easy

--TEST--
Hello World test
--FILE--
<?php
    
echo "Hello World";
?>
--EXPECT--
Hello World

Conditional tests and GET/POST args

--TEST--
Input Filter test
--SKIPIF--
if(!extension_loaded('input_filter')) print "skip";
--POST--
a=<b>1</b>
--GET--
b=<i>2</i>
--FILE--
<?php
    
echo $_POST['a'];
    echo 
$_GET['b'];
?>
--EXPECT--
12

PHPT Sections
--TEST-- title of the test
--EXTENSIONS-- load additional extensions
--XFAIL-- explain why the test is expected to fail
--CREDITS-- give yourself some credit for writing a test
--SKIPIF-- php code which prints "skip"
--REDIRECTTEST-- Reuse test from a different dir
--ARGS-- CLI args
--POST-- POST variables passed to test script
--POST_RAW-- Raw post data
--GZIP_POST-- Gzipped post data
--DEFLATE_POST-- Deflated (compressed) post data
--PUT-- Put data
--GET-- GET variables passed to test script
--COOKIE-- Cookie data
--ENV-- Environment variables
--INI-- each line contains an ini setting e.g. foo=bar
--FILE-- the test script
--FILE_EXTERNAL-- load the test script from file
--FILEEOF-- Make sure there is no trailing crlf
--EXPECT-- the expected output from the test script
--EXPECTF-- sscanf version of expected output
--EXPECTREGEX-- regex version of expected output
--EXPECTHEADERS-- Expected output headers
--CLEAN-- Cleanup code to run after test completes