Chapter 6. Testing

Table of Contents

1. The PHPUnit Test Tool
Installing PHPUnit
2. Running Tests
All Automated Tests
A Single Test Suite

The How To Test Guide.

1. The PHPUnit Test Tool

This project uses pear package PHPUnit to run the unit tests. See the PHPUnit web site [PHPUNIT-DE] for more details on how to use it.

Installing PHPUnit

 pear channel-discover pear.phpunit.de
 pear install phpunit/PHPUnit

2. Running Tests

All Automated Tests

By all tests we mean, all tests that don't need require connection.

 cd tests
 phpunit --verbose AllTests

A Single Test Suite

The test suites are in the tests directory and have names ending with Test.php by convention.

 cd tests
 phpunit FileIWantToTest.php