From 414cf70008b31fd6a10df7ded03f6c5638adab3f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 1 May 2015 14:41:15 +0100 Subject: [PATCH] Fix phar build test --- tests/Composer/Test/AllFunctionalTest.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index 1b720ad29..df8ddf185 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -65,12 +65,25 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Building the phar does not work on HHVM.'); } + $target = dirname(self::$pharPath); $fs = new Filesystem; - $fs->removeDirectory(dirname(self::$pharPath)); - $fs->ensureDirectoryExists(dirname(self::$pharPath)); - chdir(dirname(self::$pharPath)); + $fs->removeDirectory($target); + $fs->ensureDirectoryExists($target); + chdir($target); + + $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(__DIR__.'/../../../bin/compile'), dirname(self::$pharPath)); + $proc = new Process('php '.escapeshellarg('./bin/compile'), $target); $exitcode = $proc->run(); if ($exitcode !== 0 || trim($proc->getOutput())) { $this->fail($proc->getOutput());