Developer Area/Testing/Unit Testing

From Mahara Wiki
< Developer Area‎ | Testing
Revision as of 10:50, 3 February 2016 by Robertl (talk | contribs) (Setup and Running)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Unit Test Introduction

Work is currently underway to integrate phpunit unit testing in to Mahara. Documentation for phpunit is available at

Setup and Running

You'll need to already have mahara set up and installed. Default settings are copied from your running configuration and overridden with unit test settings.

Old instructions

 sudo su - www-data
  • Change directory to the root of the mahara git tree (the directory that htdocs is in)
 cd $path_to_mahara
  • Run phpunit, first option only if you have set up your cli for php properly:
 phpunit .
 php -c  /etc/php5/apache2/php.ini  /usr/bin/phpunit .
 php -c  /etc/php5/php-fpm/php.ini  /usr/bin/phpunit .

New instructions

This requires phpunit 3.7 or later which is installed by running:

make initcomposer

Unit tests can be run by:

make phpunit

From the main directory of mahara (eg, parent directory of htdocs)

Best Practices