How to install phpUnit

What is phpUnit?

PHPUnit is a unit testing framework for the PHP programming language. Created by Sebastian Bergmann, PHPUnit is one of the xUnit family of frameworks.

Why phpUnit?

To make code testing viable, good tool support is needed. This is where PHPUnit comes into play. It provides a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyze their results.

its better to install phpUnit with WAMP or XAMPP in your system
In my case I have a xampp installation in my system . if you dont have a xampp already installed in your system, here is how you can do it.

Installing XAMPP

  • Download XAMPP from http://www.apachefriends.org/en/xampp.html
  • Unpack the zip, don’t run any installer, just use the \xampp\xampp-control.exe to control the component (so the whole XAMPP directory can be moved to another drive without having absolute paths in all configurations files)

phpUnit needs the pear package installed in your php

so let start installing PEAR

  • Execute \xampp\php\go-pear.bat and follow the onscreen instructions. The installation will modify the include_path in your php.ini file.
  • Execute \xampp\php\PEAR_ENV.reg to add PEAR to the windows registry

Installing PHPUnit

  • Open a command prompt (cmd in windows)
  • Execute pear channel-discover pear.phpunit.de
  • Execute pear install phpunit/PHPUnit
  • Now you should find PHPUnit installed in \xampp\php\PEAR\PHPUnit\

And your phpUnit is ready to roll !!

One response to this post.

  1. Somebody essentially lend a hand to make seriously posts I would state.
    This is the very first time I frequented your website page and up to now?
    I amazed with the research you made to make this particular put up amazing.
    Great activity!

Leave a comment