Skip to content

OSS PHP Frameworks Unit Testing: PHPUnit

ptarjan edited this page Oct 16, 2013 · 2 revisions

PHPUnit is the primary PHP testing framework. It provides both a framework for writing tests easy as well as to run and analyze tests.

Note: The tests for PHPUnit is not run exactly like one would use PHPUnit to run other tests. While PHPUnit is the underlying framework, the tests are run via a wrapper script around PHPUnit.

Source Download

Download the latest master branch from Github

Official Testing Documentation

There does not seem to be official documentation for self-testing PHPUnit. It is fairly easy to run these tests, however; the command to do so is listed below.

Initial Setup

In order to run the PHPUnit unit tests successfully, make sure you have HHVM, Composer and other basic packages ready to go.

Some initial configuration is required for PHPUnit, particularly around dependencies.

Dependencies

We used composer to install the dependencies. In the root PHPUnit source code directory, you will find the composer.json file that will be used to download the required dependencies to run the unit tests.

hhvm [path-to-composer-phar]/composer.phar install --dev

Running the Tests

To run the PHPUnit unit tests, use the following command from the root PHPUnit directory:

`hhvm [path-to-phpunit-source-code]/phpunit.php`

phpunit.php is a wrapper script around PHPUnit.

Clone this wiki locally