One workaround - granted, not really a solution - is to bypass PEAR install and use a local copy via Composer install.
Create a file in project root called composer.json
:
{
"require": {
"phpunit/phpunit" : "3.7.*"
}
}
Of course, modify the phpunit version to "3.6.*" or similar, if you have such a requirement.
At project root:
# Install composer
$ curl -s https://getcomposer.org/installer | php
# Tell composer to install the dependencies identified in composer.json
$ php composer.phar install
# Now you can invoke the *local* copy of phpunit
$ ./vendor/phpunit/phpunit/composer/bin/phpunit --version
For simplicity, you can can create a symlink to the phpunit executable. Assuming you want the symlink in a directory called tests
:
$ ln -s ./vendor/phpunit/phpunit/composer/bin/phpunit ./tests/phpunit
Then you can invoke as (from project root):
$ cd tests
$ ./phpunit --version
Even easier, you can direct Composer to handling the symlinking for you. Add this to your composer.json
:
"config": {
"bin-dir": "tests"
}
Then, as before, you can invoke as (from project root):
$ cd tests
$ ./phpunit --version
Actually, what I usually do is have a project-level directory called scripts
and point my composer bin-dir
there. Then I manually create a symlink in tests
pointing to scripts/phpunit
. But this last step is probably more personal taste than any kind of requirement.
Maybe a long way to go just to beat PEAR issues, but I find Composer-based install works pretty reliably for me.