Install PHPUnit on Windows

“PHPUnit is a unit testing software framework for the programming language PHP. Created by Sebastian Bergmann, PHPUnit is one of the xUnit family of frameworks that originated with Kent Beck's SUnit. PHPUnit is hosted at GitHub." "PHPUnit was created with the view that the sooner you detect your code mistakes, the quicker you can fix them. Like all Unit testing frameworks PHPUnit uses assertions to verify that behaviour of the unit of code under test behaves as expected.“
wikipeadia - PHPUnit

To install PHPUnit package on your windows computer, you should install first PHP and PEAR.

Requirements

  1. PHP 5.2.7 (or later), PHP 5.3.8 (or later) is highly recommended
  2. PEAR
  3. PHPUnit 3.6

Install PHPUnit

Windows (DOS Command):

  • C:\>pear config-set auto_discover 1
  • C:\PHP>pear install phpunit/PHPUnit
    No releases available for package "pear.phpunit.de/PHPUnit"
    install failed
  • C:\PHP>pear clear-cache
    reading directory C:\Users\...\AppData\Local\Temp\pear\cache
    120 cache entries cleared
  • C:\PHP>pear update-channels
    Updating channel "doc.php.net"
    Channel "doc.php.net" is up to date
    Updating channel "pear.php.net"
    Channel "pear.php.net" is up to date
    Updating channel "pear.phpunit.de"
    Channel "pear.phpunit.de" is up to date
    Updating channel "pear.zfcampus.org"
    Channel "pear.zfcampus.org" is up to date
    Updating channel "pecl.php.net"
    Channel "pecl.php.net" is up to date
  • C:\PHP>pear config-set auto_discover 1
    config-set succeeded
  • C:\PHP>pear install phpunit/PHPUnit
    Attempting to discover channel "pear.symfony-project.com"...
    downloading channel.xml ...

PHPUnit Packages


Package

Command

Description

1. DbUnit pear install phpunit/DbUnit

DbUnit port for PHP/PHPUnit to support database interaction testing

2. PHPUnit_Selenium pear install phpunit/PHPUnit_Selenium

Selenium RC integration for PHPUnit

3. PHPUnit_Story pear install phpunit/PHPUnit_Story

Story-based test runner for Behavior-Driven Development with PHPUnit

4. PHPUnit_TestListener_DBUS pear install phpunit/PHPUnit_TestListener_DBUS

A TestListener that sends events to DBUS

5. PHPUnit_TestListener_XHProf pear install phpunit/PHPUnit_TestListener_XHProf

A TestListener that uses XHProf for automated profiling of the tested code

6. PHPUnit_TicketListener_Fogbugz pear install phpunit/PHPUnit_TicketListener_Fogbugz

A ticket listener that interacts with the Fogbugz issue API

7. PHPUnit_TicketListener_GitHub pear install phpunit/PHPUnit_TicketListener_GitHub

A ticket listener that interacts with the GitHub issue API

8. PHPUnit_TicketListener_GoogleCode pear install phpunit/PHPUnit_TicketListener_GoogleCode

A ticket listener that interacts with the Google Code issue API

9. PHPUnit_TicketListener_Trac pear install phpunit/PHPUnit_TicketListener_Trac

A ticket listener that interacts with the Trac issue API

10. PHP_Invoker pear install phpunit/PHP_Invoker

A utility class for invoking callables with a timeout. This package is required to enforce test timeouts in strict mode.

The PHPUnit source files inside your local PEAR directory will be installed.

Links