PhpUnit can be obtained through PHP extension and library (PEAE. PEAR is a framework and distribution system for reusable PHP components. You can run the PEAR installer command to install PHPUnit: pearinstallPHPUnit2 is named according to the PEAR version naming standard. the PHPUnit package for PHP5 is called phpunit2. PHPUnit is a package for PHP4, which is described later in this book. "in PHP4, this phpUnit can be obtained through PHP extensions and Libraries (PEAE. PEAR is a framework and distribution system for reusable PHP components. To install PHPUnit, run the PEAR installer command:
Pear install PHPUnit2
According to the PEAR version naming standard, the PHPUnit package for PHP5 is called PHPUnit2. PHPUnit is a package for PHP4, which will be mentioned later in the chapter "using PHPUnit in PHP4.
Only install PHPUnit. the source code of PHPUnit can be found in the local PEAR Directory. The path is usually/usr/lib/php/PHPUnit2.
Although using the PEAR installer is the only installation method supported by PHPUnit, you can still install it manually. To install it manually, follow these steps:
1. Slave.
2. prepare the phpunit script
A. rename the pear-phpunit script to phpunit.
B. rename all @ php_bin @ In the script to the directory where the PHP command line interpreter is located (usually/usr/bin/php ).
C. copy the script to the directory contained in a PATH environment variable and change the file attribute to executable (chmod + x phpunit ).
3. replace all @ package_version @ strings in the PHPUnit2/Runner/Version. php script with your installed PHPUnit Version (for example, 2.3.0 ).