Actions

Difference between revisions of "Unit Tests For The Platform"

From Joomla! Documentation

(added Testing and Bug Squad categories)
Line 35: Line 35:
  
 
will give you a list of options.
 
will give you a list of options.
[[Category:Platform]][[Category:Development]]
+
[[Category:Platform]][[Category:Development]][[Category:Testing]][[Category:Bug Squad]]

Revision as of 16:12, 13 December 2011

This is a very early stage document about running unit tests on the platform.

To run tests on the platform you will need to install PHPUnit 3.5. You may also need to update your version of PEAR to the current version. If you are using Ubuntu as your OS you will need to be at minimum on version 10.10 to update to PEAR's current package using the standard packages in the software center. You will also need to have xdebug with the current version installed.

PHP must be at least version 5.2.7 but 5.3.3 is recommended.

To install, go to the command line and type:

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install -f --alldeps phpunit/PHPUnit
pear install -f --alldeps phpunit/PHPUnit_MockObject
pear install -f --alldeps phpunit/DBUnit
pear install -f --alldeps PHP_CodeSniffer

At this point you should be able to navigate to the platform root folder and type phpunit at the prompt to start the tests.

Before running you will need to install a database for the test and enter the information. Copy config.php-dist to config.php.

You will need to create a database and import /tests/ddl.sql.

If you want to keep it simple and are sure you computer is secure, you can use the names from the file otherwise edit the file.

Names from file:

public $user = 'utuser';
public $password = 'ut1234';
public $db = 'joomla_ut';


phpunit --help 

will give you a list of options.