@@ -179,138 +179,3 @@ $str = "XYZABCD";
179179echo substr($str,3,7);
180180
181181?>
182-
183- [IMPORTANT NOTICE]
184- ------------------
185- This is an addendum to README.TESTING with additional information
186- specific to server-tests.php.
187-
188- server-tests.php is backward compatible with tests developed for
189- the original run-tests.php script. server-tests is *not* used by
190- 'make test'. server-tests was developed to provide support for
191- testing PHP under it's primary environment, HTTP, and can run the
192- PHP tests under any of the SAPI modules that are direct executables,
193- or are accessible via HTTP.
194-
195- [New features]
196- ----------------
197- * Command line interface:
198- You can run 'php server-tests.php -h' to get all the possible options.
199- * Configuration file:
200- the -c argument will allow you to use a configuration file. This is
201- handy if you are testing multiple environments and need various options
202- depending on the environment.
203- see server-tests-config.php for details.
204- * CGI Emulation:
205- Will emulate a CGI environment when testing with the cgi sapi executable.
206- * HTTP testing:
207- can be configured to run test scripts through an HTTP server running
208- on localhost. localhost is required since either the web server must
209- alias a directory to the php source directory, or the test scripts
210- must be copied to a directory under the web server
211- (see config options TEST_WEB_BASE_URL, TEST_BASE_PATH, and TEST_WEB_EXT)
212- * New sections supported for test files (see below)
213-
214- When running tests over http, tests that require ini settings different that what
215- the web server runs under will be skipped. Since the test harness defines a number
216- of ini settings by default, the web server may require special configuration to
217- make testing work.
218-
219- [Example Usage]
220- ----------------
221- Some (but not all!) examples of usage:
222-
223- 1. run tests from the php source directory
224- php server-tests.php -p /path/to/php-cli
225-
226- 2. run tests using cgi emulation
227- php server-tests.php -p /path/to/php-cgi
228-
229- 3. run tests over http, copying test files into document root
230- php server-tests.php -w -u http://localhost/test -m /path/to/htdocs/test
231-
232- 4. run tests over http, php sources have been aliased in web server
233- php server-tests.php -w -u http://localhost/test
234-
235- 5. run tests using configuration file
236- php server-tests.php -c /path/to/server-tests-config.php
237-
238- 6. run tests using configuration file, but overriding some settings:
239- (config file must be first)
240- php server-tests.php -c /path/to/server-tests-config.php -w -t 3 -d /path/to/testdir
241-
242- NOTE: configuration as described in README.TESTING still works.
243-
244- [New Test Sections]
245- ----------------
246- In addition to the traditional test sections
247- (see http://qa.php.net/write-test.php), several new sections are available
248- under server-tests.
249-
250- --POST--
251- This is not a new section, but not multipart posts are supported for testing
252- file uploads, or other types of POST data.
253-
254- --CGI--
255- This section takes no value. It merely provides a simple marker for tests
256- that MUST be run as CGI, even if there is no --POST-- or --GET-- sections
257- in the test file.
258-
259- --DESCRIPTION--
260- Not used for anything, just a section for documenting the test
261-
262- --ENV--
263- This section get's eval()'d to help build an environment for the
264- execution of the test. This can be used to change environment
265- vars that are used for CGI emulation, or simply to set env vars
266- for cli testing. A full example looks like:
267-
268- --ENV--
269- return <<<END
270- PATH_TRANSLATED=$filename
271- PATH_INFO=$scriptname
272- SCRIPT_NAME=$scriptname
273- END;
274-
275- Some variables are made easily available for use in this section, they
276- include:
277- $filename full native path to file, will become PATH_TRANSLATED
278- $filepath =dirname($filename)
279- $scriptname this is what will become SCRIPT_NAME unless you override it
280- $docroot the equivalent of DOCUMENT_ROOT under Apache
281- $cwd the directory that the test is being initiated from
282- $this->conf all server-tests configuration vars
283- $this->env all environment variables that will get passed to the test
284-
285-
286- --REQUEST--
287- This section is also eval'd, and is similar in nature to --ENV--. However,
288- this section is used to build the url used in an HTTP request. Valid values
289- to set in this section would include:
290- SCRIPT_NAME The initial part of the request url
291- PATH_INFO The pathinfo part of a request url
292- FRAGMENT The fragment section of a url (after #)
293- QUERY_STRING The query part of a url (after ?)
294-
295- --REQUEST--
296- return <<<END
297- PATH_INFO=/path/info
298- END;
299-
300- --HEADERS--
301- This section is also eval'd. It is used to provide additional headers sent
302- in an HTTP request, such as content type for multipart posts, cookies, etc.
303-
304- --HEADERS--
305- return <<<END
306- Content-Type=multipart/form-data; boundary=---------------------------240723202011929
307- Content-Length=100
308- END;
309-
310- --EXPECTHEADERS--
311- This section can be used to define what headers are required to be
312- received back from a request, and is checked in addition to the
313- regular expect sections. For example:
314-
315- --EXPECTHEADERS--
316- Status: 404
0 commit comments