ChannelRest11ReaderTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\Test\Repository\Pear;
  12. use Composer\Test\TestCase;
  13. use Composer\Test\Mock\RemoteFilesystemMock;
  14. class ChannelRest11ReaderTest extends TestCase
  15. {
  16. public function testShouldBuildPackagesFromPearSchema()
  17. {
  18. $rfs = new RemoteFilesystemMock(array(
  19. 'http://pear.1.1.net/channel.xml' => file_get_contents(__DIR__ . '/Fixtures/channel.1.1.xml'),
  20. 'http://test.loc/rest11/c/categories.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.1/categories.xml'),
  21. 'http://test.loc/rest11/c/Default/packagesinfo.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.1/packagesinfo.xml'),
  22. ));
  23. $reader = new \Composer\Repository\Pear\ChannelRest11Reader($rfs);
  24. /** @var \Composer\Package\PackageInterface[] $packages */
  25. $packages = $reader->read('http://test.loc/rest11');
  26. $this->assertCount(3, $packages);
  27. $this->assertEquals('HTTP_Client', $packages[0]->getPackageName());
  28. $this->assertEquals('HTTP_Request', $packages[1]->getPackageName());
  29. }
  30. }