ChannelRest10ReaderTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 ChannelRest10ReaderTest extends TestCase
  15. {
  16. public function testShouldBuildPackagesFromPearSchema()
  17. {
  18. $rfs = new RemoteFilesystemMock(array(
  19. 'http://test.loc/rest10/p/packages.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/packages.xml'),
  20. 'http://test.loc/rest10/p/http_client/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_info.xml'),
  21. 'http://test.loc/rest10/r/http_client/allreleases.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_allreleases.xml'),
  22. 'http://test.loc/rest10/r/http_client/deps.1.2.1.txt' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_deps.1.2.1.txt'),
  23. 'http://test.loc/rest10/p/http_request/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_info.xml'),
  24. 'http://test.loc/rest10/r/http_request/allreleases.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_allreleases.xml'),
  25. 'http://test.loc/rest10/r/http_request/deps.1.4.0.txt' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_deps.1.4.0.txt'),
  26. ));
  27. $reader = new \Composer\Repository\Pear\ChannelRest10Reader($rfs);
  28. /** @var \Composer\Package\PackageInterface[] $packages */
  29. $packages = $reader->read('http://test.loc/rest10');
  30. $this->assertCount(2, $packages);
  31. $this->assertEquals('HTTP_Client', $packages[0]->getPackageName());
  32. $this->assertEquals('HTTP_Request', $packages[1]->getPackageName());
  33. }
  34. }