Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

PHPUnit installation in Windows

From MoodleDocs

Windows 7

Install PHP

Do not try to install PHP 5.4 as there is no installer and it doesn't include the PEAR installation batch file. Instead, you have to use PHP 5.3.

You probably want the thread-safe version.

While going through the installation, you probably should use all default options, except:

  1. There is a question about which web server to use. Since you do not have PHP installed on your system already, you probably don't want to run a web server, so choose 'Do not setup a web server'.
  2. There is a list of features. Expand 'Extras' and turn on 'PEAR install'.

After install completes, open a new terminal and run 'php -version' to verify that it is installed.


Install PEAR

  • Click Start button. Type 'cmd' and, instead of pressing Return, press Ctrl + Shift + Return. This should give you a popup prompt to confirm permissions, then run the command prompt as administrator.
cd "\Program Files (x86)"\php
go-pear
  • Hit Return repeatedly to accept all defaults.
start PEAR_ENV.reg 
  • Accept adding junk to your registry.
  • Note that when I tried this, each time you run 'pear' it will come with a messagebox popup error, but this does not seem to stop it working.
  • If you use an HTTP proxy:
pear config-set http_proxy my.proxy.is:80

Install PHPUnit

  • Install PHPUnit and DbUnit:
pear config-set auto_discover 1
pear upgrade-all
pear install pear.phpunit.de/PHPUnit
pear install pear.phpunit.de/DbUnit
  • Using a text editor, edit the 'phpunit' shell script in c:\Program Files (x86)\PHP. Change the first line to:
#!php.exe