1
0
Fork 0

Fix phar build test

pull/3991/head
Jordi Boggiano 2015-05-01 14:41:15 +01:00
parent 2a48b0faa0
commit 414cf70008
1 changed files with 17 additions and 4 deletions

View File

@ -65,12 +65,25 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('Building the phar does not work on HHVM.'); $this->markTestSkipped('Building the phar does not work on HHVM.');
} }
$target = dirname(self::$pharPath);
$fs = new Filesystem; $fs = new Filesystem;
$fs->removeDirectory(dirname(self::$pharPath)); $fs->removeDirectory($target);
$fs->ensureDirectoryExists(dirname(self::$pharPath)); $fs->ensureDirectoryExists($target);
chdir(dirname(self::$pharPath)); chdir($target);
$proc = new Process('php '.escapeshellarg(__DIR__.'/../../../bin/compile'), dirname(self::$pharPath)); $it = new \RecursiveDirectoryIterator(__DIR__.'/../../../', \RecursiveDirectoryIterator::SKIP_DOTS);
$ri = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($ri as $file) {
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
if ($file->isDir()) {
$fs->ensureDirectoryExists($targetPath);
} else {
copy($file->getPathname(), $targetPath);
}
}
$proc = new Process('php '.escapeshellarg('./bin/compile'), $target);
$exitcode = $proc->run(); $exitcode = $proc->run();
if ($exitcode !== 0 || trim($proc->getOutput())) { if ($exitcode !== 0 || trim($proc->getOutput())) {
$this->fail($proc->getOutput()); $this->fail($proc->getOutput());