ArtifactRepositoryTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Repository;
  12. use Composer\Test\TestCase;
  13. use Composer\IO\NullIO;
  14. use Composer\Config;
  15. use Composer\Package\Package;
  16. class ArtifactRepositoryTest extends TestCase
  17. {
  18. public function testExtractsConfigsFromZipArchives()
  19. {
  20. $expectedPackages = array(
  21. 'composer/composer-1.0.0-alpha6',
  22. 'vendor0/package0-0.0.1',
  23. 'vendor1/package2-4.3.2',
  24. );
  25. $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts');
  26. $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
  27. $foundPackages = array_map(function(Package $package) {
  28. return "{$package->getPrettyName()}-{$package->getPrettyVersion()}";
  29. }, $repo->getPackages());
  30. $this->assertEquals($expectedPackages, $foundPackages);
  31. }
  32. }