2010-05-08 16:41:18 -04:00
|
|
|
Running Tests
|
2010-10-22 19:27:41 +02:00
|
|
|
=============
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
Prerequisites
|
2010-10-22 19:27:41 +02:00
|
|
|
=============
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
PHPUnit
|
2010-10-22 19:27:41 +02:00
|
|
|
-------
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
phpBB unit tests use PHPUnit framework. Version 3.3 or better is required
|
|
|
|
to run the tests. PHPUnit prefers to be installed via PEAR; refer to
|
|
|
|
http://www.phpunit.de/ for more information.
|
|
|
|
|
|
|
|
PHP extensions
|
2010-10-22 19:27:41 +02:00
|
|
|
--------------
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
Unit tests use several PHP extensions that board code does not use. Currently
|
|
|
|
the following PHP extensions must be installed and enabled to run unit tests:
|
|
|
|
|
|
|
|
- ctype
|
|
|
|
|
2010-10-22 19:27:41 +02:00
|
|
|
Database Tests
|
|
|
|
--------------
|
|
|
|
By default all tests requiring a database connection will use sqlite. If you
|
|
|
|
do not have sqlite installed the tests will be skipped. If you wish to run the
|
|
|
|
tests on a different database you have to create a test_config.php file within
|
|
|
|
your tests directory following the same format as phpBB's config.php. An example
|
|
|
|
for mysqli can be found below. More information on configuration options can be
|
|
|
|
found on the wiki (see below).
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$dbms = 'mysqli';
|
|
|
|
$dbhost = 'localhost';
|
|
|
|
$dbport = '';
|
|
|
|
$dbname = 'database';
|
|
|
|
$dbuser = 'user';
|
|
|
|
$dbpasswd = 'password';
|
|
|
|
|
2010-10-22 19:50:43 +02:00
|
|
|
Alternatively you can specify parameters in the environment, so e.g. the following
|
|
|
|
will run phpunit with the same parameters as in the shown test_config.php file:
|
|
|
|
|
|
|
|
$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
|
|
|
|
PHPBB_TEST_DBNAME='database' PHPBB_TEST_DBUSER='user' \
|
|
|
|
PHPBB_TEST_DBPASSWD='password' phpunit all_tests.php
|
2010-10-22 19:27:41 +02:00
|
|
|
|
2010-05-08 16:41:18 -04:00
|
|
|
Running
|
2010-10-22 19:27:41 +02:00
|
|
|
=======
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
Once the prerequisites are installed, run the tests from tests directory:
|
|
|
|
|
2010-10-22 19:50:43 +02:00
|
|
|
$ phpunit all_tests.php
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
More Information
|
2010-10-22 19:27:41 +02:00
|
|
|
================
|
2010-05-08 16:41:18 -04:00
|
|
|
|
|
|
|
Further information is available on phpbb wiki:
|
|
|
|
http://wiki.phpbb.com/display/DEV/Unit+Tests
|