First of all, thanks to @Sebastian Bergmann for reminding and sorry for my careless about this reblog because End of Life for PEAR Installation Method to PHPUnit from github and The package PHPUnit is not maintained anymore and has been superseded. Package has moved to channel pear.phpunit.de, package PHPUnit from pear.php.net.
So this blog should be a reblog of installing PHPUnit(<3.7) in Windows7 from http://thecancerus.com/ and I found it was still useful for understanding the theory of configuration of php(in wamp) and the environment variables.
The newest manual installation of PHPUnit in windows can be found its documentation.
Test contains not only unit test, integration test, but also the output of screen, including files etc.
For example, with the function exceptOutputString, we can test the string output by echo or print.
class OutputTest extends PHPUnit_Framework_TestCase
public function testExpectFooActualFoo()
$this->outputString(); // Call my local function
$this->expectOutputString('Hello world!'); // Comparaison
// local function
private function outputString()
echo "Hello world!";
Ref. Methods for output testing
PHPUnit : Manage timeout
Background : When I lanch a phpunit test, it displayed an error :
PHP_Invoker_TimeoutException: Execution aborted after 1 second
After a re-installation of the operating system Ubuntu 12.04, I got a problem by installing/using PHPUnit, this maybe not the same as your case, but I posted it just for sharing, I hope that could help.
Before all, I just want to remind that Using the PEAR Installer to install PHPUnit is no longer supported, more info in pear.phpunit.de and github.
IDE : eclipse
Warning: require(PHPUnit/Autoload.php): failed to open stream:
No such file or directory
Locate first your PHPUnit, that is to say, verify whether
PHPUnit folder is already in /usr/share/php, if yes, take a look at
the diagram below, in your eclipse, go to Window, then Preference,
then PHP Include Path, then Libraries, click Add External Source Folder.
Add /usr/share/php in your Libraries and PHPUnit will work well.
Installation and configuration of PHPUnit in Windows
Web Server:WampServer Version 2.0
PHP version should greater than 5.2.7. To install a new version of PHP, click the icon of Wamp, and then php->Version -> Get more.
Attention: if you install a new version PHP, after the installation, it is better to check the environment variable PHP_PEAR_PHP_BIN is point to the new folder of PHP. And the php.ini which will used by command line is the one you could find in the new folder of PHP.