public function testExtractsConfigsFromZipArchives()
    {
        $expectedPackages = array(
            'vendor0/package0-0.0.1',
            'composer/composer-1.0.0-alpha6',
            'vendor1/package2-4.3.2',
            'vendor3/package1-5.4.3',
            'test/jsonInRoot-1.0.0',
            'test/jsonInFirstLevel-1.0.0',
            //The files not-an-artifact.zip and jsonSecondLevel are not valid 
            //artifacts and do not get detected.
        );

        $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts');
        $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());

        $foundPackages = array_map(function(BasePackage $package) {
            return "{$package->getPrettyName()}-{$package->getPrettyVersion()}";
        }, $repo->getPackages());

        sort($expectedPackages);
        sort($foundPackages);

        $this->assertSame($expectedPackages, $foundPackages);
    }
 public function testRelativeRepoUrlCreatesRelativeUrlPackages()
 {
     $relativePath = 'tests/Composer/Test/Repository/Fixtures/artifacts';
     $coordinates = array('type' => 'artifact', 'url' => $relativePath);
     $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
     foreach ($repo->getPackages() as $package) {
         $this->assertTrue(strpos($package->getDistUrl(), $relativePath) === 0);
     }
 }
 public function testExtractsConfigsFromZipArchives()
 {
     $expectedPackages = array('vendor0/package0-0.0.1', 'composer/composer-1.0.0-alpha6', 'vendor1/package2-4.3.2');
     $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts');
     $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
     $foundPackages = array_map(function (BasePackage $package) {
         return "{$package->getPrettyName()}-{$package->getPrettyVersion()}";
     }, $repo->getPackages());
     sort($expectedPackages);
     sort($foundPackages);
     $this->assertSame($expectedPackages, $foundPackages);
 }