How to install PHPUnit without using PEAR on Mac OS X 10.5?

I'm having trouble installing PEAR, but I really only want to install PHPUnit. Does anyone have experience with this?

+7
php phpunit pear
source share
5 answers

Install via GIT

You can follow the instructions from Git README: https://github.com/sebastianbergmann/phpunit/

"git" and put them in your home directory

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 

set up personal binary path

 cd ~ && mkdir bin vi ~/.profile >> export PATH=$HOME/bin:$PATH >> :wq source ~/.profile 

create executable file

 touch ~/bin/phpunit chmod 755 ~/bin/phpunit 

write executable file

 #!/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(); 

check executable file

 which phpunit phpunit --version 
+8
source share

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, follow these steps:

  • Download the release archive from http://pear.phpunit.de/get/ and extract it to the directory specified in the include_path of your php.ini configuration file.
  • Prepare the phpunit script:
    • Rename the phpunit.php script to phpunit.
    • Replace the line with the @php_bin @ path to your PHP command line interpreter (usually / usr / bin / php).
    • Copy it to the directory that is in your path and make it executable (chmod + x phpunit).
  • Prepare the PHPUnit / Util / Fileloader.PHP script:
    • Replace the line with the @php_bin @ path to your PHP command line interpreter (usually / usr / bin / php).
+4
source share

Andrew, I am struggling with installing PHPUnit at the moment. It turned out that this helps a lot if you reload the web server after updating include_path in php.ini. Now we are looking for the exact location of the PHP command line interpreter (this is how I got here). I will inform you.

Sabina

0
source share

I just installed it today. My steps were as follows:

  • download from / get / - I used 3.3.9.tgz
  • extract all files to the pear directory (pear-phpunit, PHPUnit / etc.)
  • change @php_bin @ to point to my php file (/ usr / bin / php) in the files mentioned above.
  • create a symlink from pear-phpunit to / usr / local / bin / phpunit ( ln -s /usr/share/php/pear/pear-phpunit /usr/local/bin/phpunit )
0
source share

I recently created a github fork phpunit that currently works (mostly) without using a pear. This might work for you.

0
source share

All Articles