Merge pull request #4100 from alcohol/load-xml-as-string
load xml as string from local file, fixes #3942pull/4103/head
commit
c16ee53935
|
@ -137,7 +137,7 @@ class PearPackageExtractor
|
||||||
private function buildCopyActions($source, array $roles, $vars)
|
private function buildCopyActions($source, array $roles, $vars)
|
||||||
{
|
{
|
||||||
/** @var $package \SimpleXmlElement */
|
/** @var $package \SimpleXmlElement */
|
||||||
$package = simplexml_load_file($this->combine($source, 'package.xml'));
|
$package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
|
||||||
if (false === $package) {
|
if (false === $package) {
|
||||||
throw new \RuntimeException('Package definition file is not valid.');
|
throw new \RuntimeException('Package definition file is not valid.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,16 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testShouldExtractPackage_1_0()
|
public function testShouldExtractPackage_1_0()
|
||||||
{
|
{
|
||||||
|
$state = libxml_disable_entity_loader(true);
|
||||||
|
|
||||||
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
||||||
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v1.0', array('php' => '/'), array());
|
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v1.0', array('php' => '/'), array());
|
||||||
|
|
||||||
|
libxml_disable_entity_loader($state);
|
||||||
|
|
||||||
$expectedFileActions = array(
|
$expectedFileActions = array(
|
||||||
'Gtk.php' => array(
|
'Gtk.php' => array(
|
||||||
'from' => 'PEAR_Frontend_Gtk-0.4.0/Gtk.php',
|
'from' => 'PEAR_Frontend_Gtk-0.4.0/Gtk.php',
|
||||||
|
@ -49,12 +53,16 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testShouldExtractPackage_2_0()
|
public function testShouldExtractPackage_2_0()
|
||||||
{
|
{
|
||||||
|
$state = libxml_disable_entity_loader(true);
|
||||||
|
|
||||||
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
||||||
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.0', array('php' => '/'), array());
|
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.0', array('php' => '/'), array());
|
||||||
|
|
||||||
|
libxml_disable_entity_loader($state);
|
||||||
|
|
||||||
$expectedFileActions = array(
|
$expectedFileActions = array(
|
||||||
'URL.php' => array(
|
'URL.php' => array(
|
||||||
'from' => 'Net_URL-1.0.15/URL.php',
|
'from' => 'Net_URL-1.0.15/URL.php',
|
||||||
|
@ -68,12 +76,16 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testShouldExtractPackage_2_1()
|
public function testShouldExtractPackage_2_1()
|
||||||
{
|
{
|
||||||
|
$state = libxml_disable_entity_loader(true);
|
||||||
|
|
||||||
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
$extractor = $this->getMockForAbstractClass('Composer\Downloader\PearPackageExtractor', array(), '', false);
|
||||||
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
$method = new \ReflectionMethod($extractor, 'buildCopyActions');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.1', array('php' => '/', 'script' => '/bin'), array());
|
$fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.1', array('php' => '/', 'script' => '/bin'), array());
|
||||||
|
|
||||||
|
libxml_disable_entity_loader($state);
|
||||||
|
|
||||||
$expectedFileActions = array(
|
$expectedFileActions = array(
|
||||||
'php/Zend/Authentication/Storage/StorageInterface.php' => array(
|
'php/Zend/Authentication/Storage/StorageInterface.php' => array(
|
||||||
'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Storage/StorageInterface.php',
|
'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Storage/StorageInterface.php',
|
||||||
|
|
Loading…
Reference in New Issue