Update PearPackageExtractor for package.xml 2.1 support
parent
71ac073ebe
commit
a88265a497
|
@ -115,13 +115,13 @@ class PearPackageExtractor
|
|||
throw new \RuntimeException('Package definition file is not valid.');
|
||||
|
||||
$packageSchemaVersion = $package['version'];
|
||||
if ($packageSchemaVersion == '1.0') {
|
||||
if ('1.0' == $packageSchemaVersion) {
|
||||
$children = $package->release->filelist->children();
|
||||
$packageName = (string) $package->name;
|
||||
$packageVersion = (string) $package->release->version;
|
||||
$sourceDir = $packageName . '-' . $packageVersion;
|
||||
$result = $this->buildSourceList10($children, $role, $sourceDir);
|
||||
} elseif ($packageSchemaVersion == '2.0') {
|
||||
} elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
|
||||
$children = $package->contents->children();
|
||||
$packageName = (string) $package->name;
|
||||
$packageVersion = (string) $package->version->release;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package xmlns="http://pear.php.net/dtd/package-2.1" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.1 http://pear.php.net/dtd/package-2.1.xsd" packagerversion="2.0.0">
|
||||
<!-- stripped version of package-->
|
||||
<name>Zend_Authentication</name>
|
||||
<channel>packages.zendframework.com</channel>
|
||||
<summary>
|
||||
Package Zend_Authentication summary.\n\n" . "Package detailed description here (found in README)
|
||||
</summary>
|
||||
<description/>
|
||||
<version>
|
||||
<release>2.0.0beta4</release>
|
||||
<api>2.0.0beta4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<file role="php" name="php/Zend/Authentication/Storage/StorageInterface.php"/>
|
||||
<file role="php" name="php/Zend/Authentication/Result.php"/>
|
||||
</dir>
|
||||
</contents>
|
||||
<phprelease/>
|
||||
</package>
|
|
@ -57,4 +57,25 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
$this->assertSame($expectedFileActions, $fileActions);
|
||||
}
|
||||
|
||||
public function testShouldExtractPackage_2_1()
|
||||
{
|
||||
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
||||
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.1', 'php');
|
||||
|
||||
$expectedFileActions = array(
|
||||
0 => Array(
|
||||
'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Storage/StorageInterface.php',
|
||||
'to' => '/php/Zend/Authentication/Storage/StorageInterface.php',
|
||||
),
|
||||
1 => Array(
|
||||
'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Result.php',
|
||||
'to' => '/php/Zend/Authentication/Result.php',
|
||||
)
|
||||
);
|
||||
$this->assertSame($expectedFileActions, $fileActions);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue