Skip to content

Commit

Permalink
Update info and synch example test.
Browse files Browse the repository at this point in the history
  • Loading branch information
helly25 committed Sep 12, 2002
1 parent 861f688 commit 96f7bcc
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions README.TESTING
Expand Up @@ -20,16 +20,16 @@ as follows
./sapi/cli/php -c /path/to/php.ini/ run-tests.php [ext/some_extension_name]



[Which "php" executable "make test" look for]
---------------------------------------------
You must use TEST_PHP_EXECUTABLE environment variable to explicitly
select the php executable to be used to run the tests. That can either
be the CLI or CGI executable.

"make test" executes "run-tests.php" script with "php" binary. Some
test scripts such as session must be executed by CGI SAPI. Therefore,
you must build PHP with CGI SAPI to perform all tests.

If PHP is not build with CGI SAPI, "run-tests.php" script uses CLI
SAPI. Tests that may not executed by CLI SAPI will be skipped.

NOTE: PHP binary executing "run-tests.php" and php binary used for
executing test scripts may differ. If you use different PHP binary for
executing "run-tests.php" script, you may get errors.
Expand All @@ -42,7 +42,7 @@ you would like to test with other configuration file, user
"run-tests.php" script.

Example:
./sapi/cli/php -c /path/to/php.ini/ ext/standard
./sapi/cli/php -c /path/to/php.ini/ run-tests.php ext/standard

If you use php.ini other than php.ini-dist, you may see more failed
tests.
Expand All @@ -55,10 +55,11 @@ by looking all directory named "tests". If there are files have "phpt"
extension, "run-tests.php" takes test php code from the file and
executes it.

Tester can easily executes tests selectively with as follows.
Tester can easily execute tests selectively with as follows.

Example:
Examples:
./sapi/cli/php -c /path/to/php.ini/ run-tests.php ext/mbstring
./sapi/cli/php -c /path/to/php.ini/ run-tests.php ext/mbstring/020.phpt


[Test results]
Expand All @@ -69,12 +70,19 @@ executed to the test script directory. For example, if
ext/myext/tests/myext.phpt is failed to pass, following files are
created:

ext/myext/tests/myext.out - output from test script
ext/myext/tests/myext.exp - expected output
ext/myext/tests/myext.php - test script executed
ext/myext/tests/myext.log - log of test execution (L)
ext/myext/tests/myext.exp - expected output (E)
ext/myext/tests/myext.out - output from test script (O)
ext/myext/tests/myext.diff - diff of .out and .exp (D)

Tester can verify these files, if failed test is actually a bug
or not.
Tester can verify these files, if failed test is actually a bug or not.

NOTE: The files generated by tests can be selected by setting the
environment variable TEST_PHP_LOG_FORMAT. For each file you want to be
generated use the character in brackets as shown above (default is LEOD).

NOTE: You can set environment variable TEST_PHP_DETAILED to enable
detailed test information.


[Creating new test files]
Expand All @@ -87,19 +95,20 @@ has following format. Here is a actual test file from iconv module.
UCS4BE to ASCII
--SKIPIF--
<?php include('skipif.inc'); ?>
--POST--
--GET--
--FILE--
<?php include('002.inc'); ?>
--EXPECT--
&#97;&#98;&#99;&#100;
abcd
===== end of ext/iconv/002.phpt =======

As you can see the file has the following sections:

"--TEST--" is title of the test.
"--SKIPIF--" is condition when to skip this test.
"--POST--" is POST variable passed to test script.
"--GET--" is GET variable passed to test script.
"--SKIPIF--" is condition when to skip this test (optional).
"--POST--" is POST variable passed to test script (optional).
"--GET--" is GET variable passed to test script (optional).
"--INI--" each line contains an ini setting e.g. foo=bar (optional).
"--FILE--" is the test script.
"--EXPECT--" is the expected output from the test script.

Expand Down Expand Up @@ -141,12 +150,9 @@ abcd
?>
=== end of ext/iconv/002.inc ===

Test script and skipif code may be directly write into *.phpt.
Test script and skipif code may be directly written into *.phpt.
However, it is recommended to use other files for ease of writing
test script. For instance, you can execute test script under
ext/iconv as follows:

./sapi/cli/php -c /path/to/php.ini/ ext/iconv
test scripts.


[How to help us]
Expand Down

0 comments on commit 96f7bcc

Please sign in to comment.