Configuring and Running PHP's OCI8 tests
By cj on Apr 10, 2007
The PHP source code includes tests for all the core functionality and extensions. You should run the tests after building PHP.
The test suite can't test everything. You should test your applications with your new PHP too. This gives load and real-life testing not possible with PHP's script based test suite.
You should also strongly consider contributing tests to the PHP
community. Adding tests that are relevant to your application
minimizes the risks of PHP developers breaking PHP features important
The tests in ext/oci8/tests verify the behavior of the OCI8 extension. To run them follow these steps.
1. Edit ext/oci8/tests/details.inc and set the Oracle SYSTEM user password for your database:
$user = "system";
$password = "mypassword";(In older versions of PHP these variables are located in connect.inc).
The OCI8 tests rely on being able to create tables, types, stored procedures etc. If you change $user you may have to grant that database user extra privileges.
At the bottom of details.inc set the connection string for the database:
$dbase = "//localhost/XE";
If PHP is running on the same machine as the database then also set:
$oracle_on_localhost = TRUE;
This specifies whether to test functionality that has the Oracle database reading files created directly by PHP. If the database and PHP are not using the same file system this is not possible and the variable should be set FALSE.
2. In your php.ini check that variables_order has "E", for example:
variables_order = "EGPCS"
Without this flag, Oracle environment variables won't get propagated through the test system and tests will fail to connect.
3. Set any necessary Oracle environment variables in your shell. E.g. for PHP linked with Oracle XE enter:
$ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
Note the space after the full stop.
4. Finally you can run the tests:
$ cd /home/cjones/myphpsource
$ make test
If you want to run just the OCI8 tests use:
$ make test TESTS=ext/oci8
The test scripts run sequentially and their status reported:
CWD : /home/cjones/php
PHP : /home/cjones/php/sapi/cli/php
PHP_SAPI : cli
PHP_VERSION : 5.2.2
PHP_OS : Linux - Linux localhost.localdomain 2.6.9-18.104.22.168.1.EL
INI actual : /home/cjones/php/lib/php.ini
More .INIs :
Extra dirs :
Running selected tests.
PASS oci_bind_array_by_name() and invalid values 1 [ext/oci8/tests/array_bind_001.phpt]
PASS oci_bind_array_by_name() and invalid values 2 [ext/oci8/tests/array_bind_002.phpt]
PASS oci_bind_array_by_name() and invalid values 3 [ext/oci8/tests/array_bind_003.phpt]
. . .Successful tests begin with PASS. Tests that are to be skipped in the current configuration are marked SKIP. Failing tests are marked FAIL. A summary of the failing tests is given at the completion of the tests.
Occasionally a few tests are known to fail. These might be for unfixed bugs, or where portability of the test can not be guaranteed. The output of failing tests is kept for your analysis. For example if ext/oci8/tests/demotest.phpt fails these files will be in ext/oci8/tests:
demotest.phpt : the test framework script
demotest.php : the actual PHP file executed
demotest.out : actual output when the test ran
demotest.exp : the expected output as coded in the .phpt file
demotest.diff : difference between actual and expected output
demotest.log : the actual and expected output in a single file
Examine the failures and report any problems to firstname.lastname@example.org. New tests can be sent to that address too.
More information on PHP testing is on the PHP web site Writing Tests
Update: PHP 5.2.2 Release Candidate 1 has just been announced. This has quite a few changes. Test it!