Installing PHPUnit on WAMPServer

Test Driven Development and xUnit seem to be popular among many of the professional and very public programmers, so I thought I might like to give it a whirl and see if I can improve the flexibility of my source code and better decouple objects. Unfortunately, I use WAMPServer on Windows as a development server while at work so directions for installing PHP related plugins/PEAR aren’t exactly identical. (Usually, I can figure it out fairly quickly.)

Installing WAMPServer is fairly quick and well documented online, so I won’t cover it specifically although I will mention I am using WAMPServer v2 at time of this writing. I will also assume that you have used the default file paths of “C:wamp” and “C:wampwww”

Steps to installing PHPUnit:

  1. Install PEAR if you haven’t already by opening up a new command window and entering the following commands

    cd wampbinphpphp5.3.0
    go-pear.bat
  2. Press enter when the list of directories appears
  3. When asked if you want PHP.ini to be modified press Y and then enter.
  4. You will be told the include path is updated. Press enter.
  5. You be will be told PEAR_ENV.reg has been created.
    PEAR_ENV.reg
  6. Pear is installed, but it isn’t the newest version of the updater, so we should update because PHPUnit requires at least PEAR Updater 1.8.1
    pear update-channels
  7. Thankfully, we are nearly done our journey. We simply need to add a channel to PEAR and then we can install!
    pear channel-discover pear.phpunit.de
    pear install –alldeps phpunit/PHPUnit

Good luck testing and keep checking back to see how to test!

Comments

  1. WebDevHobo says

    Alright, that worked.

    One thing I don’t get is the locations. PEAR asks for the location of the “Public Web Files Directory”

    As far as I know, that’s “Cwampwww”

    I’m not sure, but I did change it from the suggested path. What’s up with those anyway?

    • Brian R Cline says

      I’m glad to hear that worked. If you don’t mind me asking, where did you install?

  2. WebDevHobo says

    In the pear folder itself.

    C:wampbinphpphp5.3.0PEAR

    So under that folder, all the stuff was downloaded.

    Sadly, haven’t tested anything yet.