2012-06-09 05:48:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of Composer.
|
|
|
|
*
|
|
|
|
* (c) Nils Adermann <naderman@naderman.de>
|
|
|
|
* Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2016-10-05 08:45:22 +00:00
|
|
|
namespace Composer\Test\Repository\Pear;
|
2012-06-09 05:48:52 +00:00
|
|
|
|
2018-11-12 14:23:32 +00:00
|
|
|
use Composer\Test\TestCase;
|
2018-10-31 11:44:54 +00:00
|
|
|
use Composer\Test\Mock\HttpDownloaderMock;
|
2012-06-09 05:48:52 +00:00
|
|
|
|
|
|
|
class ChannelRest11ReaderTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testShouldBuildPackagesFromPearSchema()
|
|
|
|
{
|
2019-01-18 11:14:47 +00:00
|
|
|
$httpDownloader = new HttpDownloaderMock(array(
|
2012-06-09 05:48:52 +00:00
|
|
|
'http://pear.1.1.net/channel.xml' => file_get_contents(__DIR__ . '/Fixtures/channel.1.1.xml'),
|
|
|
|
'http://test.loc/rest11/c/categories.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.1/categories.xml'),
|
|
|
|
'http://test.loc/rest11/c/Default/packagesinfo.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.1/packagesinfo.xml'),
|
|
|
|
));
|
|
|
|
|
2019-01-18 11:14:47 +00:00
|
|
|
$reader = new \Composer\Repository\Pear\ChannelRest11Reader($httpDownloader);
|
2012-06-09 05:48:52 +00:00
|
|
|
|
2018-11-12 14:23:32 +00:00
|
|
|
/** @var \Composer\Package\PackageInterface[] $packages */
|
2012-06-09 05:48:52 +00:00
|
|
|
$packages = $reader->read('http://test.loc/rest11');
|
|
|
|
|
|
|
|
$this->assertCount(3, $packages);
|
|
|
|
$this->assertEquals('HTTP_Client', $packages[0]->getPackageName());
|
|
|
|
$this->assertEquals('HTTP_Request', $packages[1]->getPackageName());
|
|
|
|
}
|
|
|
|
}
|