4 PHPUnit is the de-facto standard for unit testing in PHP projects. It provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.
9 PHPUnit should be installed using the [PEAR Installer](http://pear.php.net/). This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0.
11 The PEAR channel (`pear.phpunit.de`) that is used to distribute PHPUnit needs to be registered with the local PEAR environment. Furthermore, components that PHPUnit depends upon are hosted on additional PEAR channels.
13 pear channel-discover pear.phpunit.de
14 pear channel-discover components.ez.no
15 pear channel-discover pear.symfony-project.com
17 This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:
19 pear install phpunit/PHPUnit
21 After the installation you can find the PHPUnit source files inside your local PEAR directory; the path is usually `/usr/lib/php/PHPUnit`.
26 The documentation for PHPUnit is available in different formats:
28 * [English, multiple HTML files](http://www.phpunit.de/manual/3.5/en/index.html)
29 * [English, single HTML file](http://www.phpunit.de/manual/3.5/en/phpunit-book.html)
30 * [English, PDF](http://www.phpunit.de/manual/3.5/en/phpunit-book.pdf)
31 * [English, ePub](http://www.phpunit.de/manual/3.5/en/phpunit-book.epub)
32 * [Japanese, multiple HTML files](http://www.phpunit.de/manual/3.5/ja/index.html)
33 * [Japanese, single HTML file](http://www.phpunit.de/manual/3.5/ja/phpunit-book.html)
34 * [Japanese, PDF](http://www.phpunit.de/manual/3.5/ja/phpunit-book.pdf)
35 * [Japanese, ePub](http://www.phpunit.de/manual/3.5/ja/phpunit-book.epub)
40 * Send an email to `user-subscribe@phpunit.de` to subscribe to the `phpunit-user` mailing list. This is a medium volume list for general PHPUnit support; ask PHPUnit questions here.
41 * Send an email to `dev-subscribe@phpunit.de` to subscribe to the `phpunit-dev` mailing list. This is a low volume list for those who want to help out with the development of PHPUnit.
46 The [#phpunit channel on the Freenode IRC network](irc://freenode.net/phpunit) is a place to chat about PHPUnit.
48 Using PHPUnit From a Git Checkout
49 ---------------------------------
51 The following commands can be used to perform the initial checkout of PHPUnit and its dependencies from Git:
53 mkdir phpunit && cd phpunit
54 git clone git://github.com/sebastianbergmann/phpunit.git
55 git clone git://github.com/sebastianbergmann/dbunit.git
56 git clone git://github.com/sebastianbergmann/php-file-iterator.git
57 git clone git://github.com/sebastianbergmann/php-text-template.git
58 git clone git://github.com/sebastianbergmann/php-code-coverage.git
59 git clone git://github.com/sebastianbergmann/php-token-stream.git
60 git clone git://github.com/sebastianbergmann/php-timer.git
61 git clone git://github.com/sebastianbergmann/phpunit-mock-objects.git
62 git clone git://github.com/sebastianbergmann/phpunit-selenium.git
64 The `dbunit`, `php-code-coverage`, `php-file-iterator`, `php-text-template`, `php-timer`, `php-token-stream`, `phpunit`, `phpunit-mock-objects`, and `phpunit-selenium` directories need to be added to the `include_path`.
66 The `phpunit/phpunit.php` script can be used to invoke the PHPUnit test runner.
68 The following commands can be used to check out the appropriate branches for PHPUnit 3.5:
70 cd phpunit && git checkout 3.5 && cd ..
71 cd dbunit && git checkout 1.0 && cd ..
72 cd php-file-iterator && git checkout 1.2 && cd ..
73 cd php-code-coverage && git checkout 1.0 && cd ..
74 cd php-token-stream && git checkout 1.0 && cd ..
75 cd phpunit-mock-objects && git checkout 1.0 && cd ..
76 cd phpunit-selenium && git checkout 1.0 && cd ..
78 The following commands can be used to check out the appropriate branches for PHPUnit 3.6:
80 cd phpunit && git checkout master && cd ..
81 cd dbunit && git checkout master && cd ..
82 cd php-file-iterator && git checkout master && cd ..
83 cd php-code-coverage && git checkout master && cd ..
84 cd php-token-stream && git checkout master && cd ..
85 cd phpunit-mock-objects && git checkout master && cd ..
86 cd phpunit-selenium && git checkout master && cd ..