The release of our SalesKing PHP SDK, threw up the question of how to run the included PHPUnit test’s. I’am using Ubuntu 12 / Precise Pangolin, and assume you already have PHP installed. This tutorial covers of how to install the software base and how to run the tests from the command line(bash).

1. Install PEAR

PEAR is a(the) PHP extension and application repository, sporting easy package management for a wide range of libraries. Its latest version is easily installed from Ubuntu’s apt repository:

[cc]sudo apt-get install pear[/cc]
2. Install PHPUnit

First enable pear to automatically discover repositories and then install PHPUnit:
[cc]sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
[/cc]

3. Run SalesKing PHP SDK Unit test’s

Our SDK needs Curl to communicate with the API. Most linux systems already have it installed, but since we use it from PHP a little wrapper is needed:
[cc]sudo apt-get install php5-curl[/cc]
Now go to the SalesKing PHP SDK directory and see the tests pass:
[cc]phpunit tests/[/cc]