Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Unit testing the Moodle block

Benjamin Jakobus edited this page Apr 9, 2014 · 9 revisions

**Note: ** You must have PHPUnit installed before proceeding.

  1. Create a new database: moodle_unit_testing
  2. Edit /etc/apache2/sites-available/default-ssl and insert the following:
Alias /moodle-unit-testing "/path/to/moodle/moodle-unit-testing/"

<Directory /path/to/moodle/moodle-unit-testing/>

	Options Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	allow from all
</Directory>
  1. Restart apache using sudo service apache2 restart
  2. Install a new moodle instance by navigating your browser to: https://localhost/moodle-unit-testing. Configure it to use the database created in step 1.
  3. Install the ibmsbt block
  4. Go to moodle-unit-testing/blocks/ibmsbt/tests
  5. To run the unit tests, use the following command: **phpunit --coverage-html ./report *_test.php **