I am having trouble installing PEAR, but I really only want to install PHPUnit. Does anyone have experience doing this?
I just installed it today. My steps were as follows:
ln -s /usr/share/php/pear/pear-phpunit /usr/local/bin/phpunit
)You can follow the instructions from the Git README: https://github.com/sebastianbergmann/phpunit/
cd ~ && mkdir phpunit && cd phpunit
git clone git://github.com/sebastianbergmann/phpunit.git
git clone git://github.com/sebastianbergmann/dbunit.git
git clone git://github.com/sebastianbergmann/php-file-iterator.git
git clone git://github.com/sebastianbergmann/php-text-template.git
git clone git://github.com/sebastianbergmann/php-code-coverage.git
git clone git://github.com/sebastianbergmann/php-token-stream.git
git clone git://github.com/sebastianbergmann/php-timer.git
git clone git://github.com/sebastianbergmann/phpunit-mock-objects.git
git clone git://github.com/sebastianbergmann/phpunit-selenium.git
cd ~ && mkdir bin
vi ~/.profile
>> export PATH=$HOME/bin:$PATH
>> :wq
source ~/.profile
touch ~/bin/phpunit
chmod 755 ~/bin/phpunit
#!/usr/bin/env php
<?php
// set main method
define('PHPUnit_MAIN_METHOD','PHPUnit_TextUI_Command::main');
// add phpunit to the include path
$paths = scandir($_ENV['HOME'].'/phpunit');
$includes = array();
foreach($paths as $path){
if (!preg_match('/^\./', $path)){
$includes[] = $_ENV['HOME'].'/phpunit/' . $path;
}
}
set_include_path(implode(PATH_SEPARATOR,$includes).PATH_SEPARATOR.get_include_path());
// set the auto loader
require 'PHPUnit/Autoload.php';
// execute
PHPUnit_TextUI_Command::main();
which phpunit
phpunit --version
From the PHPUnit installation guide:
Although using the PEAR Installer is the only supported way to install PHPUnit, you can install PHPUnit manually. For manual installation, do the following:
I recently made a github fork of phpunit that currently works (mostly) without the use of pear. It might work for you.
Andrew, I am wrestling with installing PHPUnit at the moment. Found out that it helps a lot if restart your Webserver after updating the include_path in php.ini. Now looking for the exact location of the PHP command line interpreter (that is how I got here). I'll keep you informed.
Sabine