Is it possible to package PHPUnit tests as a PHAR archive, and run them using phpunit?
I've created a .phar with the follow script:
<?php
$cPhar = new Phar('mytests-archive.phar', 0);
$cPhar->addFile('mytest.php');
$sStub = <<<ENDSTUB
#! /usr/bin/php
<?php
Phar::mapPhar('mytest-archive.phar');
require 'phar://mytests-archive.phar/mytest.php';
__HALT_COMPILER();
ENDSTUB;
$cPhar->setStub($sStub);
$cPhar->compressFiles(Phar::GZ);
$cPhar->stopBuffering();
?>
But when I then try running the resulting archive as follows:
phpunit mytests-archive.phar
I get the error message:
#! /usr/bin/php
PHPUnit 3.3.17 by Sebastian Bergmann.
Class MyTestClass could not be found in /path/to/mytests-archive.phar
Does PHPUnit not support PHAR files, or am I missing a step in my build script? (This is my first attempt at using PHAR)