qa:runtests:howtorun

This is an old revision of the document!


Running the new version of run-tests.php

Extract the code

Checkout the code from the PHP git repository like this:

git clone http://git.php.net/repository/phpruntests.git

Under the phpruntests directory you will find all the source code under the directory /src and all of the unit tests under the directory /tests. The main program is called run-tests.php. The main program is located in the directory /src.

Create a test runner

Create a script called 'runtests' in your bin directory (or any directory that is on your PATH) with this content:

#!/bin/sh 
export TEST_PHP_EXECUTABLE=/location/of/php_to_test/php 
export TEST_PHP_CGI_EXECUTABLE=/location/of/php_cgi_to_test/php-cgi
$TEST_PHP_EXECUTABLE /where/you/put/runtests/run-tests.php $* 

In the same way as the original script, this version demands that the PHP executable is set before it will run. You do not need to specify the CGI executable, the run-tests.php code will attempt to guess its location (as the current code does) from the location of the cli.

Run the code

At the moment the code will run a single test, eg:

 runtests my_test.phpt

All the tests under a given directory, eg:

  runtests ext/standard/tests/

The output format is different to run-tests.php. If a single test is run a short summary is printed to stdout. If one or more directories of tests are run the output is printed after each group (directory) of tests has been run. Again, a summary is printed to stdout but details are written to a file.

runtests --help

will give you all of the possible command line options.

run-tests.php on Windows

Running the code should be the same, you will need a runtests.bat file rather than a shell script.

qa/runtests/howtorun.1337673546.txt.gz · Last modified: 2017/09/22 13:28 (external edit)