mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
No longer needed. See README.TESTING
This commit is contained in:
parent
9f6a8748e1
commit
f1d158c41c
60
tests/README
60
tests/README
@ -1,60 +0,0 @@
|
||||
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
|
Loading…
Reference in New Issue
Block a user