summaryrefslogtreecommitdiff
path: root/README.TESTING
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-10-23 12:59:18 +0000
committerMarcus Boerger <helly@php.net>2002-10-23 12:59:18 +0000
commit9da3c884fb0e955f4ef7d89cb113372791e3371a (patch)
tree30ebdbaf31b4f5016f9d11aa8bda30518973f7b4 /README.TESTING
parent69ce017d2895dfa53bbb8943f0e063c2b0666c63 (diff)
downloadphp-git-9da3c884fb0e955f4ef7d89cb113372791e3371a.tar.gz
update and correct
Diffstat (limited to 'README.TESTING')
-rw-r--r--README.TESTING46
1 files changed, 35 insertions, 11 deletions
diff --git a/README.TESTING b/README.TESTING
index aab8f9e7f4..2c2635e2e2 100644
--- a/README.TESTING
+++ b/README.TESTING
@@ -81,7 +81,7 @@ ext/myext/tests/myext.diff - diff of .out and .exp (D)
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).
-The php file will be generated allways.
+The php file will be generated always.
NOTE: You can set environment variable TEST_PHP_DETAILED to enable
detailed test information.
@@ -106,13 +106,15 @@ abcd
As you can see the file has the following sections:
-"--TEST--" is title of the test.
-"--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.
+"--TEST--" is title of the test.
+"--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.
+"--EXPECTF--" this is the alternate form of --EXPECT--. The difference
+ is is that this form uses sscanf for output validation.
ext/iconv/002.phpt uses 2 files. "skipif.inc" is used to skip
test when test cannot be performed such as iconv module is not
@@ -152,11 +154,33 @@ abcd
?>
=== end of ext/iconv/002.inc ===
-Test script and skipif code may be directly written into *.phpt.
-However, it is recommended to use other files for ease of writing
-test scripts.
+Test script and SKIPIF code should be directly written into *.phpt.
+However, it is recommended to use include files when more test scripts
+depend on the same SKIPIF code or when certain test files need the same
+values for some input.
+/ext/standard/tests/strings 003.phpt is a good example for using EXPECTF
+instead of EXPECT. From time to time the algorythmn used for shuffle
+changed and sometimes the machine used to execute the code has influence
+on the result of shuffle. But it always retuns a three character string
+detectable by %s. Other forms scanable are %i for integers, %f for
+floating point values and %x for hexadecimal values.
+
+==== /ext/standard/tests/strings 003.phpt ===
+--TEST--
+Testing str_shuffle.
+--FILE--
+<?php
+$s = '123';
+var_dump(str_shuffle($s));
+var_dump($s);
+?>
+--EXPECTF--
+string(3) %s
+string(3) "123"
+==== end of /ext/standard/tests/strings 003.phpt ===
+
[How to help us]
----------------
If you find bug in PHP, you can submit bug report AND test script