mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add PEAR channel reader & Update PearRepository to use it.
This commit is contained in:
parent
ee2834a169
commit
e173f11b37
29 changed files with 1970 additions and 342 deletions
|
@ -13,6 +13,7 @@
|
|||
namespace Composer\Test\Mock;
|
||||
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Downloader\TransportException;
|
||||
|
||||
/**
|
||||
* Remote filesystem mock
|
||||
|
@ -29,10 +30,11 @@ class RemoteFilesystemMock extends RemoteFilesystem
|
|||
|
||||
public function getContents($originUrl, $fileUrl, $progress = true)
|
||||
{
|
||||
if(!empty($this->contentMap[$fileUrl]))
|
||||
if (!empty($this->contentMap[$fileUrl])) {
|
||||
return $this->contentMap[$fileUrl];
|
||||
}
|
||||
|
||||
throw new \Composer\Downloader\TransportException('The "'.$fileUrl.'" file could not be downloaded (NOT FOUND)', 404);
|
||||
throw new TransportException('The "'.$fileUrl.'" file could not be downloaded (NOT FOUND)', 404);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
144
tests/Composer/Test/Repository/Pear/ChannelReaderTest.php
Normal file
144
tests/Composer/Test/Repository/Pear/ChannelReaderTest.php
Normal file
|
@ -0,0 +1,144 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository\Pear;
|
||||
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Test\Mock\RemoteFilesystemMock;
|
||||
|
||||
class ChannelReaderTest extends TestCase
|
||||
{
|
||||
public function testShouldBuildPackagesFromPearSchema()
|
||||
{
|
||||
$rfs = new RemoteFilesystemMock(array(
|
||||
'http://pear.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'),
|
||||
));
|
||||
|
||||
$reader = new \Composer\Repository\Pear\ChannelReader($rfs);
|
||||
|
||||
$channelInfo = $reader->read('http://pear.net/');
|
||||
$packages = $channelInfo->getPackages();
|
||||
|
||||
$this->assertCount(3, $packages);
|
||||
$this->assertEquals('HTTP_Client', $packages[0]->getPackageName());
|
||||
$this->assertEquals('HTTP_Request', $packages[1]->getPackageName());
|
||||
$this->assertEquals('MDB2', $packages[2]->getPackageName());
|
||||
|
||||
$mdb2releases = $packages[2]->getReleases();
|
||||
$this->assertEquals(9, count($mdb2releases['2.4.0']->getDependencyInfo()->getOptionals()));
|
||||
}
|
||||
|
||||
public function testShouldSelectCorrectReader()
|
||||
{
|
||||
$rfs = new RemoteFilesystemMock(array(
|
||||
'http://pear.1.0.net/channel.xml' => file_get_contents(__DIR__ . '/Fixtures/channel.1.0.xml'),
|
||||
'http://test.loc/rest10/p/packages.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/packages.xml'),
|
||||
'http://test.loc/rest10/p/http_client/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_info.xml'),
|
||||
'http://test.loc/rest10/p/http_request/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_info.xml'),
|
||||
'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'),
|
||||
));
|
||||
|
||||
$reader = new \Composer\Repository\Pear\ChannelReader($rfs);
|
||||
|
||||
$reader->read('http://pear.1.0.net/');
|
||||
$reader->read('http://pear.1.1.net/');
|
||||
}
|
||||
|
||||
public function testShouldCreatePackages()
|
||||
{
|
||||
$reader = $this->getMockBuilder('\Composer\Repository\Pear\ChannelReader')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$ref = new \ReflectionMethod($reader, 'buildComposerPackages');
|
||||
$ref->setAccessible(true);
|
||||
|
||||
$packageInfo = new PackageInfo(
|
||||
'test.loc',
|
||||
'sample',
|
||||
'license',
|
||||
'shortDescription',
|
||||
'description',
|
||||
array(
|
||||
'1.0.0.1' => new ReleaseInfo(
|
||||
'stable',
|
||||
new DependencyInfo(
|
||||
array(
|
||||
new DependencyConstraint(
|
||||
'required',
|
||||
'> 5.2.0.0',
|
||||
'php',
|
||||
''
|
||||
),
|
||||
new DependencyConstraint(
|
||||
'conflicts',
|
||||
'== 2.5.6.0',
|
||||
'pear.php.net',
|
||||
'broken'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'*' => array(
|
||||
new DependencyConstraint(
|
||||
'optional',
|
||||
'*',
|
||||
'ext',
|
||||
'xml'
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$packages = $ref->invoke($reader, 'test.loc', 'test', array($packageInfo));
|
||||
|
||||
$expectedPackage = new MemoryPackage('pear-test.loc/sample', '1.0.0.1' , '1.0.0.1');
|
||||
$expectedPackage->setType('library');
|
||||
$expectedPackage->setDistType('pear');
|
||||
$expectedPackage->setDescription('description');
|
||||
$expectedPackage->setDistUrl("http://test.loc/get/sample-1.0.0.1.tgz");
|
||||
$expectedPackage->setAutoload(array('classmap' => array('')));
|
||||
$expectedPackage->setIncludePaths(array('/'));
|
||||
$expectedPackage->setRequires(array(
|
||||
new Link('pear-test.loc/sample', 'php', $this->createConstraint('>', '5.2.0.0'), 'required', '> 5.2.0.0'),
|
||||
));
|
||||
$expectedPackage->setConflicts(array(
|
||||
new Link('pear-test.loc/sample', 'pear-pear.php.net/broken', $this->createConstraint('==', '2.5.6.0'), 'conflicts', '== 2.5.6.0'),
|
||||
));
|
||||
$expectedPackage->setSuggests(array(
|
||||
'*-ext-xml' => '*',
|
||||
));
|
||||
$expectedPackage->setReplaces(array(
|
||||
new Link('pear-test.loc/sample', 'pear-test/sample', new VersionConstraint('==', '1.0.0.1'), 'replaces', '== 1.0.0.1'),
|
||||
));
|
||||
|
||||
$this->assertCount(1, $packages);
|
||||
$this->assertEquals($expectedPackage, $packages[0], 0, 1);
|
||||
}
|
||||
|
||||
private function createConstraint($operator, $version)
|
||||
{
|
||||
$constraint = new VersionConstraint($operator, $version);
|
||||
$constraint->setPrettyString($operator.' '.$version);
|
||||
|
||||
return $constraint;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository\Pear;
|
||||
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Test\Mock\RemoteFilesystemMock;
|
||||
|
||||
class ChannelRest10ReaderTest extends TestCase
|
||||
{
|
||||
public function testShouldBuildPackagesFromPearSchema()
|
||||
{
|
||||
$rfs = new RemoteFilesystemMock(array(
|
||||
'http://test.loc/rest10/p/packages.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/packages.xml'),
|
||||
'http://test.loc/rest10/p/http_client/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_info.xml'),
|
||||
'http://test.loc/rest10/r/http_client/allreleases.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_client_allreleases.xml'),
|
||||
'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'),
|
||||
'http://test.loc/rest10/p/http_request/info.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_info.xml'),
|
||||
'http://test.loc/rest10/r/http_request/allreleases.xml' => file_get_contents(__DIR__ . '/Fixtures/Rest1.0/http_request_allreleases.xml'),
|
||||
'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'),
|
||||
));
|
||||
|
||||
$reader = new \Composer\Repository\Pear\ChannelRest10Reader($rfs);
|
||||
|
||||
/** @var $packages \Composer\Package\PackageInterface[] */
|
||||
$packages = $reader->read('http://test.loc/rest10');
|
||||
|
||||
$this->assertCount(2, $packages);
|
||||
$this->assertEquals('HTTP_Client', $packages[0]->getPackageName());
|
||||
$this->assertEquals('HTTP_Request', $packages[1]->getPackageName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository\Pear;
|
||||
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Test\Mock\RemoteFilesystemMock;
|
||||
|
||||
class ChannelRest11ReaderTest extends TestCase
|
||||
{
|
||||
public function testShouldBuildPackagesFromPearSchema()
|
||||
{
|
||||
$rfs = new RemoteFilesystemMock(array(
|
||||
'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'),
|
||||
));
|
||||
|
||||
$reader = new \Composer\Repository\Pear\ChannelRest11Reader($rfs);
|
||||
|
||||
/** @var $packages \Composer\Package\PackageInterface[] */
|
||||
$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());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
[
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : "*",
|
||||
"channel" : "pear.php.net",
|
||||
"name" : "Foo"
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "pkg", "rel": "has", "name": "Foo" }
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"package": {
|
||||
"name": "Foo",
|
||||
"channel": "pear.php.net"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : ">1.0.0.0",
|
||||
"channel" : "pear.php.net",
|
||||
"name" : "Foo"
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "pkg", "rel": "gt", "version": "1.0.0", "name": "Foo" }
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"package": {
|
||||
"name": "Foo",
|
||||
"channel": "pear.php.net",
|
||||
"min": "1.0.0",
|
||||
"exclude": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "conflicts",
|
||||
"constraint" : "*",
|
||||
"channel" : "pear.php.net",
|
||||
"name" : "Foo"
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "pkg", "rel": "not", "name": "Foo" }
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"package": {
|
||||
"name": "Foo",
|
||||
"channel": "pear.php.net",
|
||||
"conflicts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : ">=1.0.0.0",
|
||||
"channel" : "pear.php.net",
|
||||
"name" : "Foo"
|
||||
},
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : "<2.0.0.0",
|
||||
"channel" : "pear.php.net",
|
||||
"name" : "Foo"
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "pkg", "rel": "ge", "version": "1.0.0", "name": "Foo" },
|
||||
{ "type": "pkg", "rel": "lt", "version": "2.0.0", "name": "Foo" }
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"package": [
|
||||
{
|
||||
"name": "Foo",
|
||||
"channel": "pear.php.net",
|
||||
"min": "1.0.0"
|
||||
},
|
||||
{
|
||||
"name": "Foo",
|
||||
"channel": "pear.php.net",
|
||||
"max": "2.0.0",
|
||||
"exclude": "2.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : ">=5.3.0.0",
|
||||
"channel" : "php",
|
||||
"name" : ""
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "php", "rel": "ge", "version": "5.3"}
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"php": {
|
||||
"min": "5.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "required",
|
||||
"constraint" : "*",
|
||||
"channel" : "ext",
|
||||
"name" : "xmllib"
|
||||
}
|
||||
],
|
||||
"1.0": [
|
||||
{ "type": "ext", "rel": "has", "name": "xmllib"}
|
||||
],
|
||||
"2.0": {
|
||||
"required": {
|
||||
"extension": [
|
||||
{
|
||||
"name": "xmllib"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expected": [
|
||||
{
|
||||
"type" : "optional",
|
||||
"constraint" : "*",
|
||||
"channel" : "ext",
|
||||
"name" : "xmllib"
|
||||
}
|
||||
],
|
||||
"1.0": false,
|
||||
"2.0": {
|
||||
"optional": {
|
||||
"extension": [
|
||||
{
|
||||
"name": "xmllib"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<a xmlns="http://pear.php.net/dtd/rest.allreleases" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases http://pear.php.net/dtd/rest.allreleases.xsd">
|
||||
<p>HTTP_Client</p>
|
||||
<c>pear.net</c>
|
||||
<r>
|
||||
<v>1.2.1</v>
|
||||
<s>stable</s>
|
||||
</r>
|
||||
</a>
|
|
@ -0,0 +1 @@
|
|||
a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.4.3";}s:7:"package";a:3:{s:4:"name";s:12:"HTTP_Request";s:7:"channel";s:8:"pear.net";s:3:"min";s:5:"1.4.0";}}}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<p xmlns="http://pear.php.net/dtd/rest.package" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.package http://pear.php.net/dtd/rest.package.xsd">
|
||||
<n>HTTP_Client</n>
|
||||
<c>pear.net</c>
|
||||
<ca xlink:href="/rest/c/Default">Default</ca>
|
||||
<l>BSD</l>
|
||||
<s>
|
||||
Easy way to perform multiple HTTP requests and process their results
|
||||
</s>
|
||||
<d>
|
||||
The HTTP_Client class wraps around HTTP_Request and provides a higher level interface for performing multiple HTTP requests. Features: * Manages cookies and referrers between requests * Handles HTTP redirection * Has methods to set default headers and request parameters * Implements the Subject-Observer design pattern: the base class sends events to listeners that do the response processing.
|
||||
</d>
|
||||
<r xlink:href="/rest/r/http_client"/>
|
||||
</p>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<a xmlns="http://pear.php.net/dtd/rest.allreleases" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases http://pear.php.net/dtd/rest.allreleases.xsd">
|
||||
<p>HTTP_Request</p>
|
||||
<c>pear.net</c>
|
||||
<r>
|
||||
<v>1.4.0</v>
|
||||
<s>stable</s>
|
||||
</r>
|
||||
</a>
|
|
@ -0,0 +1 @@
|
|||
a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:7:"Net_URL";s:7:"channel";s:12:"pear.dev.loc";s:3:"min";s:6:"1.0.12";}i:1;a:3:{s:4:"name";s:10:"Net_Socket";s:7:"channel";s:8:"pear.net";s:3:"min";s:5:"1.0.2";}}}}
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<p xmlns="http://pear.php.net/dtd/rest.package" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.package http://pear.php.net/dtd/rest.package.xsd">
|
||||
<n>HTTP_Request</n>
|
||||
<c>pear.net</c>
|
||||
<ca xlink:href="/rest/c/Default">Default</ca>
|
||||
<l>BSD</l>
|
||||
<s>Provides an easy way to perform HTTP requests</s>
|
||||
<d>
|
||||
Supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc.
|
||||
</d>
|
||||
<r xlink:href="/rest/r/http_request"/>
|
||||
</p>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<a xmlns="http://pear.php.net/dtd/rest.allpackages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.allpackages http://pear.php.net/dtd/rest.allpackages.xsd">
|
||||
<c>pear.net</c>
|
||||
<p>HTTP_Client</p>
|
||||
<p>HTTP_Request</p>
|
||||
</a>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<a xmlns="http://pear.php.net/dtd/rest.allcategories" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.allcategories http://pear.php.net/dtd/rest.allcategories.xsd">
|
||||
<ch>pear.net</ch>
|
||||
<c xlink:href="/rest/c/Default/info.xml">Default</c>
|
||||
</a>
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<f xmlns="http://pear.php.net/dtd/rest.categorypackageinfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.categorypackageinfo http://pear.php.net/dtd/rest.categorypackageinfo.xsd">
|
||||
<pi>
|
||||
<p>
|
||||
<n>HTTP_Client</n>
|
||||
<c>pear.net</c>
|
||||
<ca xlink:href="/rest/c/Default">Default</ca>
|
||||
<l>BSD</l>
|
||||
<s>
|
||||
Easy way to perform multiple HTTP requests and process their results
|
||||
</s>
|
||||
<d>
|
||||
The HTTP_Client class wraps around HTTP_Request and provides a higher level interface for performing multiple HTTP requests. Features: * Manages cookies and referrers between requests * Handles HTTP redirection * Has methods to set default headers and request parameters * Implements the Subject-Observer design pattern: the base class sends events to listeners that do the response processing.
|
||||
</d>
|
||||
<r xlink:href="/rest/r/http_client"/>
|
||||
</p>
|
||||
<a>
|
||||
<r>
|
||||
<v>1.2.1</v>
|
||||
<s>stable</s>
|
||||
</r>
|
||||
</a>
|
||||
<deps>
|
||||
<v>1.2.1</v>
|
||||
<d>a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.4.3";}s:7:"package";a:3:{s:4:"name";s:12:"HTTP_Request";s:7:"channel";s:8:"pear.net";s:3:"min";s:5:"1.4.0";}}}</d>
|
||||
</deps>
|
||||
</pi>
|
||||
<pi>
|
||||
<p>
|
||||
<n>HTTP_Request</n>
|
||||
<c>pear.net</c>
|
||||
<ca xlink:href="/rest/c/Default">Default</ca>
|
||||
<l>BSD</l>
|
||||
<s>Provides an easy way to perform HTTP requests</s>
|
||||
<d>
|
||||
Supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc.
|
||||
</d>
|
||||
<r xlink:href="/rest/r/http_request"/>
|
||||
</p>
|
||||
<a>
|
||||
<r>
|
||||
<v>1.4.0</v>
|
||||
<s>stable</s>
|
||||
</r>
|
||||
</a>
|
||||
<deps>
|
||||
<v>1.4.0</v>
|
||||
<d>a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:7:"Net_URL";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:6:"1.0.12";}i:1;a:3:{s:4:"name";s:10:"Net_Socket";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.0.2";}}}}</d>
|
||||
</deps>
|
||||
</pi>
|
||||
<pi>
|
||||
<p><n>MDB2</n>
|
||||
<c>pear.net</c>
|
||||
<ca xlink:href="/rest/c/Database">Database</ca>
|
||||
<l>BSD License</l>
|
||||
<s>database abstraction layer</s>
|
||||
<d>PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers.
|
||||
|
||||
It provides a common API for all supported RDBMS. The main difference to most
|
||||
other DB abstraction packages is that MDB2 goes much further to ensure
|
||||
portability. MDB2 provides most of its many features optionally that
|
||||
can be used to construct portable SQL statements:
|
||||
* Object-Oriented API
|
||||
* A DSN (data source name) or array format for specifying database servers
|
||||
* Datatype abstraction and on demand datatype conversion
|
||||
* Various optional fetch modes to fix portability issues
|
||||
* Portable error codes
|
||||
* Sequential and non sequential row fetching as well as bulk fetching
|
||||
* Ability to make buffered and unbuffered queries
|
||||
* Ordered array and associative array for the fetched rows
|
||||
* Prepare/execute (bind) named and unnamed placeholder emulation
|
||||
* Sequence/autoincrement emulation
|
||||
* Replace emulation
|
||||
* Limited sub select emulation
|
||||
* Row limit emulation
|
||||
* Transactions/savepoint support
|
||||
* Large Object support
|
||||
* Index/Unique Key/Primary Key support
|
||||
* Pattern matching abstraction
|
||||
* Module framework to load advanced functionality on demand
|
||||
* Ability to read the information schema
|
||||
* RDBMS management methods (creating, dropping, altering)
|
||||
* Reverse engineering schemas from an existing database
|
||||
* SQL function call abstraction
|
||||
* Full integration into the PEAR Framework
|
||||
* PHPDoc API documentation</d>
|
||||
<r xlink:href="/rest/r/mdb2"/>
|
||||
</p>
|
||||
<a>
|
||||
<r><v>2.4.0</v><s>stable</s></r>
|
||||
</a>
|
||||
<deps>
|
||||
<v>2.4.0</v>
|
||||
<d>a:2:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.3.6";}}s:5:"group";a:9:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:29:"Frontbase SQL driver for MDB2";s:4:"name";s:5:"fbsql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_fbsql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.3.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:34:"Interbase/Firebird driver for MDB2";s:4:"name";s:5:"ibase";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_ibase";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:2;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:21:"MySQL driver for MDB2";s:4:"name";s:5:"mysql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_mysql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:3;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:22:"MySQLi driver for MDB2";s:4:"name";s:6:"mysqli";}s:10:"subpackage";a:3:{s:4:"name";s:18:"MDB2_Driver_mysqli";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:4;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:29:"MS SQL Server driver for MDB2";s:4:"name";s:5:"mssql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_mssql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.2.0";}}i:5;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:22:"Oracle driver for MDB2";s:4:"name";s:4:"oci8";}s:10:"subpackage";a:3:{s:4:"name";s:16:"MDB2_Driver_oci8";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:6;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PostgreSQL driver for MDB2";s:4:"name";s:5:"pgsql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_pgsql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:7;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:24:"Querysim driver for MDB2";s:4:"name";s:8:"querysim";}s:10:"subpackage";a:3:{s:4:"name";s:20:"MDB2_Driver_querysim";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.6.0";}}i:8;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:23:"SQLite2 driver for MDB2";s:4:"name";s:6:"sqlite";}s:10:"subpackage";a:3:{s:4:"name";s:18:"MDB2_Driver_sqlite";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}}}</d>
|
||||
</deps>
|
||||
</pi>
|
||||
</f>
|
12
tests/Composer/Test/Repository/Pear/Fixtures/channel.1.0.xml
Normal file
12
tests/Composer/Test/Repository/Pear/Fixtures/channel.1.0.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<channel xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://pear.php.net/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd">
|
||||
<name>pear.net</name>
|
||||
<summary>Test PEAR channel</summary>
|
||||
<suggestedalias>test_alias</suggestedalias>
|
||||
<servers>
|
||||
<primary>
|
||||
<rest>
|
||||
<baseurl type="REST1.0">http://test.loc/rest10/</baseurl>
|
||||
</rest>
|
||||
</primary>
|
||||
</servers>
|
||||
</channel>
|
12
tests/Composer/Test/Repository/Pear/Fixtures/channel.1.1.xml
Normal file
12
tests/Composer/Test/Repository/Pear/Fixtures/channel.1.1.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<channel xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://pear.php.net/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd">
|
||||
<name>pear.net</name>
|
||||
<summary>Test PEAR channel</summary>
|
||||
<suggestedalias>test_alias</suggestedalias>
|
||||
<servers>
|
||||
<primary>
|
||||
<rest>
|
||||
<baseurl type="REST1.1">http://test.loc/rest11/</baseurl>
|
||||
</rest>
|
||||
</primary>
|
||||
</servers>
|
||||
</channel>
|
|
@ -0,0 +1,58 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository\Pear;
|
||||
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class PackageDependencyParserTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider dataProvider10
|
||||
* @param $expected
|
||||
* @param $data
|
||||
*/
|
||||
public function testShouldParseDependencies($expected, $data10, $data20)
|
||||
{
|
||||
$expectedDependencies = array();
|
||||
foreach ($expected as $expectedItem) {
|
||||
$expectedDependencies[] = new DependencyConstraint(
|
||||
$expectedItem['type'],
|
||||
$expectedItem['constraint'],
|
||||
$expectedItem['channel'],
|
||||
$expectedItem['name']
|
||||
);
|
||||
}
|
||||
|
||||
$parser = new PackageDependencyParser();
|
||||
|
||||
if (false !== $data10) {
|
||||
$result = $parser->buildDependencyInfo($data10);
|
||||
$this->assertEquals($expectedDependencies, $result->getRequires() + $result->getOptionals(), "Failed for package.xml 1.0 format");
|
||||
}
|
||||
|
||||
if (false !== $data20) {
|
||||
$result = $parser->buildDependencyInfo($data20);
|
||||
$this->assertEquals($expectedDependencies, $result->getRequires() + $result->getOptionals(), "Failed for package.xml 2.0 format");
|
||||
}
|
||||
}
|
||||
|
||||
public function dataProvider10()
|
||||
{
|
||||
$data = json_decode(file_get_contents(__DIR__.'/Fixtures/DependencyParserTestData.json'), true);
|
||||
if (0 !== json_last_error()) {
|
||||
throw new \PHPUnit_Framework_Exception('Invalid json file.');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -29,11 +29,11 @@ class PearRepositoryTest extends TestCase
|
|||
*/
|
||||
private $remoteFilesystem;
|
||||
|
||||
public function testComposerNonCompatibleRepositoryShouldSetIncludePath()
|
||||
public function testComposerShouldSetIncludePath()
|
||||
{
|
||||
$url = 'pear.phpmd.org';
|
||||
$expectedPackages = array(
|
||||
array('name' => 'pear-phpmd/PHP_PMD', 'version' => '1.3.3'),
|
||||
array('name' => 'pear-pear.phpmd.org/PHP_PMD', 'version' => '1.3.3'),
|
||||
);
|
||||
|
||||
$repoConfig = array(
|
||||
|
@ -78,53 +78,47 @@ class PearRepositoryTest extends TestCase
|
|||
public function repositoryDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'pear.phpunit.de',
|
||||
array(
|
||||
array('name' => 'pear-phpunit/PHPUnit_MockObject', 'version' => '1.1.1'),
|
||||
array('name' => 'pear-phpunit/PHPUnit', 'version' => '3.6.10'),
|
||||
array('name' => 'pear-pear.phpunit.de/PHPUnit_MockObject', 'version' => '1.1.1'),
|
||||
array('name' => 'pear-pear.phpunit.de/PHPUnit', 'version' => '3.6.10'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.php.net',
|
||||
array(
|
||||
array('name' => 'pear-pear/PEAR', 'version' => '1.9.4'),
|
||||
array('name' => 'pear-pear.php.net/PEAR', 'version' => '1.9.4'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.pdepend.org',
|
||||
array(
|
||||
array('name' => 'pear-pdepend/PHP_Depend', 'version' => '1.0.5'),
|
||||
array('name' => 'pear-pear.pdepend.org/PHP_Depend', 'version' => '1.0.5'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.phpmd.org',
|
||||
array(
|
||||
array('name' => 'pear-phpmd/PHP_PMD', 'version' => '1.3.3'),
|
||||
array('name' => 'pear-pear.phpmd.org/PHP_PMD', 'version' => '1.3.3'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.doctrine-project.org',
|
||||
array(
|
||||
array('name' => 'pear-doctrine/DoctrineORM', 'version' => '2.2.2'),
|
||||
array('name' => 'pear-pear.doctrine-project.org/DoctrineORM', 'version' => '2.2.2'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.symfony-project.com',
|
||||
array(
|
||||
array('name' => 'pear-symfony/YAML', 'version' => '1.0.6'),
|
||||
array('name' => 'pear-pear.symfony-project.com/YAML', 'version' => '1.0.6'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'pear.pirum-project.org',
|
||||
array(
|
||||
array('name' => 'pear-pirum/Pirum', 'version' => '1.1.4'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'packages.zendframework.com',
|
||||
array(
|
||||
array('name' => 'pear-zf2/Zend_Code', 'version' => '2.0.0.0-beta3'),
|
||||
array('name' => 'pear-pear.pirum-project.org/Pirum', 'version' => '1.1.4'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue