ArtifactRepositoryTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\TestCase;
  13. use Composer\IO\NullIO;
  14. use Composer\Config;
  15. use Composer\Package\BasePackage;
  16. class ArtifactRepositoryTest extends TestCase
  17. {
  18. public function testExtractsConfigsFromZipArchives()
  19. {
  20. $expectedPackages = array(
  21. 'vendor0/package0-0.0.1',
  22. 'composer/composer-1.0.0-alpha6',
  23. 'vendor1/package2-4.3.2',
  24. 'vendor3/package1-5.4.3',
  25. );
  26. $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts');
  27. $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
  28. $foundPackages = array_map(function(BasePackage $package) {
  29. return "{$package->getPrettyName()}-{$package->getPrettyVersion()}";
  30. }, $repo->getPackages());
  31. sort($expectedPackages);
  32. sort($foundPackages);
  33. $this->assertSame($expectedPackages, $foundPackages);
  34. }
  35. }