Phar

I took Derick's blog posting on Phar as an incentive to finally experiment with it myself.

<?php
$phar = new Phar('phpunit-3.3-svn.phar', 0, 'phpunit-3.3-svn.phar');
$phar->buildFromDirectory('/usr/local/src/phpunit/release/3.3', '/\.php$/');
 
$stub = <<<ENDSTUB
#! /usr/local/php-5.3/bin/php
<?php
Phar::mapPhar('phpunit-3.3-svn.phar');
require 'phar://phpunit-3.3-svn.phar/PHPUnit/TextUI/Command.php';
__HALT_COMPILER();
ENDSTUB;
 
$phar->setStub($stub);
$phar->compressFiles(Phar::GZ);
$phar->stopBuffering();
?>

Running the script above will create a phpunit-3.3-svn.phar Phar archive that contains the complete PHPUnit distribution.

Furthermore, you can directly invoke the PHPUnit command-line test runner by execution the Phar archive.