Table of Contents
Simpletest provider (pun_admin_simpletest)
- Status: early development
- Current version: none
General idea
Provide the SimpleTest unit tester files to run extension and core automatic tests.
Specification
- pun_admin_simpletest 1.0
- Place the SimpleTest codes to
/extensions/pun_admin_simpletest/simpletest/
. - Forum administrator must modify
config.php
onpun_admin_simpletest
installation to connect to the testing DB if we run the tests (see blow). - Create base PunBB testing helpers:
- Simple helpers: add user (registration), category, forum, topic, post (reply).
- Let them be a methods of the class (let it be named
pun_test_case
), inherited form the properWebTestCase
SimpleTest testing class. Extensions should use this class for their tests. - Place the class into
/extensions/pun_admin_simpletest/pun_tester.php
.
- Allow to run tests to the admin only. (This may be tricky due to
config.php
modification.)
- pun_admin_simpletest 2.0
- Scan for the tests in:
<FORUM_ROOT>/simpletest.php
for the PunBB core test./extensions/<extension_id>/simpletest.php
for the particular extension test.
- Provide graphical interface in admin console to run the tests found:
- The list of tests found with checkboxes.
- Use PunBB admin layout to display the test results.
Documentation
Installation
Add the next lines to the end of your config (<FORUM_ROOT>/config.php
):
if (defined('PUN_SIMPLETEST_RUN') && PUN_SIMPLETEST_RUN) { // Other DB access here // $db_name = 'punbb_test'; // Just an example }
Test file
- Name it
simpletest.php
- Place it into extension's root directory, e.g.
/extensions/pun_pm/simpletest.php
. - Use
require_once '../pun_admin_simpletest/pun_tester.php';
and inherit fromPunTestCase
for your test class, e.g.class test_of_pun_pm extends pun_test_case { … }
- Open
http://<FORUM_URL>/extensions/<extension_id>/simpletest.php
to run the extension test, e.g.http://example.com/punbb/extensions/pun_pm/simpletest.php
. (You must be logged it as forum administrator.)
Links
- Track ticket: #159