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.
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
?>
=== 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