Permalink
Browse files

update and correct

  • Loading branch information...
1 parent 69ce017 commit 9da3c884fb0e955f4ef7d89cb113372791e3371a Marcus Boerger committed Oct 23, 2002
Showing with 35 additions and 11 deletions.
  1. +35 −11 README.TESTING
View
@@ -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

0 comments on commit 9da3c88

Please sign in to comment.