Permalink
Browse files

Add test building phar and run functional tests with the phar, refs #…

  • Loading branch information...
1 parent 5a763cf commit 5f3814bd05983d364f373cd9c077cd14fec9291c @Seldaek Seldaek committed Nov 11, 2012
Showing with 27 additions and 1 deletion.
  1. +27 −1 tests/Composer/Test/AllFunctionalTest.php
@@ -14,6 +14,7 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
protected $oldcwd;
protected $oldenv;
protected $testDir;
+ private static $pharPath;
public function setUp()
{
@@ -34,11 +35,36 @@ public function tearDown()
putenv('COMPOSER_HOME='.$this->oldenv);
$this->oldenv = null;
}
+ }
+
+ public static function setUpBeforeClass()
+ {
+ self::$pharPath = sys_get_temp_dir().'/composer-phar-test/composer.phar';
+ }
+
+ public static function tearDownAfterClass()
+ {
+ $fs = new Filesystem;
+ $fs->removeDirectory(dirname(self::$pharPath));
+ }
+
+ public function testBuildPhar()
+ {
+ $fs = new Filesystem;
+ $fs->removeDirectory(dirname(self::$pharPath));
+ $fs->ensureDirectoryExists(dirname(self::$pharPath));
+ chdir(dirname(self::$pharPath));
+
+ $proc = new Process('php '.escapeshellarg(__DIR__.'/../../../bin/compile'));
+ $exitcode = $proc->run();
+ $this->assertSame(0, $exitcode);
+ $this->assertTrue(file_exists(self::$pharPath));
}
/**
* @dataProvider getTestFiles
+ * @depends testBuildPhar
*/
public function testIntegration(\SplFileInfo $testFile)
{
@@ -47,7 +73,7 @@ public function testIntegration(\SplFileInfo $testFile)
$this->oldenv = getenv('COMPOSER_HOME');
putenv('COMPOSER_HOME='.$this->testDir.'home');
- $cmd = 'php '.__DIR__.'/../../../bin/composer --no-ansi '.$testData['RUN'];
+ $cmd = 'php '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'];
$proc = new Process($cmd);
$exitcode = $proc->run();

0 comments on commit 5f3814b

Please sign in to comment.