Differences

This shows you the differences between the selected revision and the current version of the page.

punbb13:pun_admin_simpletest 2008/10/09 06:31 current
Line 1: Line 1:
 +====== Simpletest provider (pun_admin_simpletest) ======
 +[[punbb13:Official extensions|PunBB 1.3 official extension]]
 +  * Status: **early development**
 +  * Current version: **none**
 +===== General idea =====
 +Provide the [[http://simpletest.org/|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'' on ''pun_admin_simpletest'' installation to connect to the testing DB if we run the tests ([[#Installation|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 proper ''WebTestCase'' 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''):
 +<code=php>
 +if (defined('PUN_SIMPLETEST_RUN') && PUN_SIMPLETEST_RUN)
 +{
 +  // Other DB access here
 +  // $db_name = 'punbb_test'; // Just an example
 +}
 +</code>
 +==== 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 from ''PunTestCase'' 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

Personal Tools