Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

creates a local git repo instead of fetching a remote one

  • Loading branch information...
commit dfed86f4ed830200773301119eca304d7b8dbce6 1 parent 1de018e
Ulf Harnhammar authored
View
16 tests/Composer/Test/Package/Dumper/DumperTest.php
@@ -15,19 +15,21 @@
abstract class DumperTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @todo Replace with local git repo to run offline.
- */
public function getPackageName()
{
- $package = new MemoryPackage('lagged/Lagged_Session_SaveHandler_Memcache', '0.5.0', '0.5.0');
- $package->setSourceUrl('git://github.com/lagged/Lagged_Session_SaveHandler_Memcache.git');
- $package->setSourceReference('0.5.0');
+ $testdir = '/tmp/composer_dumpertest_git_repository';
+
+ system("rm -rf $testdir; mkdir $testdir");
+ system("cd $testdir; git init; echo 'a' > b; git add b; git commit -m test");
+
+ $package = new MemoryPackage('dumpertest/dumpertest', 'master', 'master');
+ $package->setSourceUrl("file://$testdir");
+ $package->setSourceReference('master');
$package->setSourceType('git');
$name = preg_replace('#[^a-z0-9_-]#', '-', $package->getUniqueName());
- $retu = array('package' => $package, 'name' => $name);
+ $retu = array('package' => $package, 'name' => $name);
return $retu;
}
}
View
3  tests/Composer/Test/Package/Dumper/TarDumperTest.php
@@ -15,9 +15,6 @@
class TarDumperTest extends DumperTest
{
- /**
- * @todo Replace with local git repo to run offline.
- */
public function testThis()
{
$retu = $this->getPackageName();
View
18 tests/Composer/Test/Package/Dumper/ZipDumperTest.php
@@ -12,27 +12,19 @@
namespace Composer\Test\Package\Dumper;
use Composer\Package\Dumper\ZipDumper;
-use Composer\Package\MemoryPackage;
-class ZipDumperTest extends \PHPUnit_Framework_TestCase
+class ZipDumperTest extends DumperTest
{
- /**
- * @todo Replace with local git repo to run offline.
- */
public function testThis()
{
- $package = new MemoryPackage('lagged/Lagged_Session_SaveHandler_Memcache', '0.5.0', '0.5.0');
- $package->setSourceUrl('git://github.com/lagged/Lagged_Session_SaveHandler_Memcache.git');
- $package->setSourceReference('0.5.0');
- $package->setSourceType('git');
+ $retu = $this->getPackageName();
+ $package = $retu['package'];
+ $name = $retu['name'];
$temp = sys_get_temp_dir();
-
$zip = new ZipDumper($temp);
$zip->dump($package);
- $name = preg_replace('#[^a-z0-9_-]#', '-', $package->getUniqueName());
-
$dist = sprintf('%s/%s.zip',
$temp, $name
);
@@ -47,4 +39,4 @@ public function testException()
{
new ZipDumper("/totally-random-" . time());
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.