Elentok's Blog

About me

Install PHPUnit on WampServer

I'm using WampServer 2.1 (with PHP 5.3.4) on Windows 7 64-bit.

This guide was made with the help of Itay Adler.

Step 1 - Installing the PEAR package manager

  • Add the php directory (in my case "d:\wamp\bin\php\php5.3.4") to your PATH (via Advanced System Settings, Environment Variables)
  • Download http://pear.php.net/go-pear.phar to somewhere (let's say "C:\Temp\pear")
  • Open a new command prompt as an administrator:
    cd c:\temp\pear
    php go-pear.phar

Step 2 - Installing PHPUnit

Open a new command prompt as an administrator:

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

Step 3 - Testing PHPUnit

  • Create a file called "MyTest.php" with the following code:
    class MyTest extends PHPUnit_Framework_TestCase
      public function testOneEqualsOne()
        $this->assertEquals(1, 1);
  • Open a new command prompt and run: phpunit MyTest.php
  • You should see the following output:

    PHPUnit 3.5.15 by Sebastian Bergmann.
    Time: 0 seconds, Memory: 5.25Mb
    OK (1 test, 1 assertion)
Next:Custom CSS folding in Vim