php-src/tests
2001-11-13 12:20:31 +00:00
..
basic Make these tests work regardless of the register_globals setting. 2001-11-13 12:20:31 +00:00
classes - Convert cfunction -> function. 2001-04-26 19:42:08 +00:00
func @PHP 3 regression testing framework re-born (Stig) 2000-08-27 19:46:06 +00:00
lang fixed. 2001-06-21 18:58:55 +00:00
strings printf argnum (parameter swapping) support from Morten Poulsen 2001-04-09 15:44:24 +00:00
dirname.phpt Sync the expected output with Linux dirname output. The test passes now. 2000-12-24 14:40:37 +00:00
foo More cleanup. 1999-07-08 21:56:19 +00:00
foo2 More cleanup. 1999-07-08 21:56:19 +00:00
foo3 More cleanup. 1999-07-08 21:56:19 +00:00
foo4 Testing. 2000-05-12 13:55:51 +00:00
odbc-display.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
odbc-t1.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
odbc-t2.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
odbc-t3.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
odbc-t4.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
odbc-t5.php Test scripts for ODBC added 2000-05-28 12:50:19 +00:00
quicktester.inc Fix the pow-test, it now succeeds on my machine 2001-10-05 23:37:08 +00:00
README changed run-tests.php to use 'php -q' instead of 'php -f' 2000-12-03 10:45:53 +00:00
recurse - Make Win32 compile again 1999-12-18 17:44:56 +00:00
run.html - Fix some issues with the ISAPI module, made it friendlier to non Win32 platforms 2000-02-18 17:59:44 +00:00
run.php - Fix some issues with the ISAPI module, made it friendlier to non Win32 platforms 2000-02-18 17:59:44 +00:00
scan_cases PHP code to test sscanf() 2000-06-06 19:15:26 +00:00
test_class_inheritance Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
test.php4 test 1999-10-08 15:23:58 +00:00
test.pl Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
testarray test 2000-06-14 15:37:06 +00:00
testarray2 test 2000-05-12 12:29:59 +00:00
testarray2.pl Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
testarray.pl Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
testclassfunc mailing list test 1999-10-08 16:00:10 +00:00
testcom Object overloading API changed slightly (llist is now a pointer) 2000-04-10 20:21:02 +00:00
testcpdf - extended test script for cpdf by GD image insertion 1999-11-23 09:04:31 +00:00
testcpdfclock - The pdfclock example using cpdf 2000-07-12 12:50:58 +00:00
testdom - test script for rewritten domxml module 2001-03-20 15:02:10 +00:00
testfe testing 1999-10-08 15:29:13 +00:00
testfunc Another test. 2000-05-12 12:45:28 +00:00
testfunc2 - Get rid of warning 1999-09-28 17:37:06 +00:00
testfunc2.pl Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
testfunc.pl Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
testfuncref - Converted math.c to use new convert_to_number_ex() macro. 1999-10-15 06:31:40 +00:00
testhyperwave - add test for hw_insertanchors() 2000-12-12 16:02:19 +00:00
testinclude bonsai test 2000-06-20 19:21:11 +00:00
testobj test 2000-05-12 12:49:20 +00:00
testpfpro.php test file for pfpro 2000-07-15 03:07:49 +00:00
testscanf.php PHP code to test sscanf() 2000-06-06 19:15:26 +00:00
testswf - test script to test creation of flash files 2000-05-17 15:45:56 +00:00

PHP Regression Tests
====================

To run the tests, go to the top-level directory and
run "./php -q run-tests.php".

Without parameters, "run-tests.php" will recursively scan through the
file tree looking for directories called "tests", and run all the
tests (.phpt files) within (recursively).

To run tests in a single directory, pass the directory as a parameter:
"./php -q run-tests.php tests/lang".

To run one or more single tests, pass them as parameters:
"./php -q run-tests.php tests/lang/015.phpt".

The format of the .phpt files is quite simple.  There are 6 possible
sections.  Test, Skipif, Post, Get, File and Expect.  The Test section
contains the description of the test.  The Skipif section contains
code that should print "skip" if this test should be skipped for some
reason (such as an extension that is not compiled in).  The Post
section contains any post data that the script might need.  The Get
section contains any Get data.  Note that both the Post and the Get
sections need to have this data in url-encoded format.  The File
section contains the actual script and the Expect section is the
expected output, sans headers.  Blank lines are ignored in the
expected output.

A simple example which takes one argument through the POST method
and one through the GET and displays these would be:

--TEST--
Simple GET and POST test
--SKIPIF--
--POST--
a=Hello
--GET--
b=There
--FILE--
<?php echo "$a $b">
--EXPECT--
Hello There

Another simple example that only runs if the PCRE extension is loaded:

--TEST--
Simple Perl regexp test
--SKIPIF--
<?php if (!extension_loaded("pcre")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
$str="Hello 42 World";
if (pcre_match('/^([a-z]+)\s+(\d+)\s+([a-z]+)/i', $str, $matches)) {
    printf("%s %s: %d\n", $matches[1], $matches[3], $matches[2]);
}
?>
--EXPECT--
Hello World: 42