diff --git a/src/PEARX/Package.php b/src/PEARX/Package.php index 105fbaf..501d5c0 100644 --- a/src/PEARX/Package.php +++ b/src/PEARX/Package.php @@ -365,7 +365,7 @@ public function getInstallFileList($sourceDir = null, $distDir = null) return $filelist; } - public function addConfigureOptions($optName, $prompt, $default = NULL) { + public function addConfigureOption($optName, $prompt, $default = NULL) { $this->configureOptions[] = array( 'name' => $optName, 'prompt' => $prompt, @@ -373,5 +373,8 @@ public function addConfigureOptions($optName, $prompt, $default = NULL) { ); } + public function getConfigureOptions() { + return $this->configureOptions; + } } diff --git a/src/PEARX/PackageXml/Parser.php b/src/PEARX/PackageXml/Parser.php index 4acb984..63fe4fa 100644 --- a/src/PEARX/PackageXml/Parser.php +++ b/src/PEARX/PackageXml/Parser.php @@ -58,9 +58,10 @@ public function parse($arg) if ($extName = $xml->providesextension->__toString()) { $package->setProvidesExtension($extName); } - if ($releaseInfo = $xml->extsrcrelease) { - foreach ($releaseInfo->configureoption as $opt) { - $package->addConfigureOptions($opt->name, $opt->prompt, $opt->default); + + if ($extsrcrelease = $xml->extsrcrelease) { + foreach ($extsrcrelease->children() as $opt) { + $package->addConfigureOption($opt['name'], $opt['prompt'], $opt['default']); } } diff --git a/tests/PEARX/PackageXml/ParserTest.php b/tests/PEARX/PackageXml/ParserTest.php index 79e6790..9317717 100644 --- a/tests/PEARX/PackageXml/ParserTest.php +++ b/tests/PEARX/PackageXml/ParserTest.php @@ -61,6 +61,24 @@ public function testForExtension() ok($package->getZendExtSrcRelease()); } + public function testConfigureOptions() + { + $parser = new PEARX\PackageXml\Parser; + ok($parser); + + $package = $parser->parse('tests/data/package_xml/apcu/package.xml'); + $options = $package->getConfigureOptions(); + $this->assertNotEmpty($options); + + count_ok( 2, $options); + foreach($options as $option) { + ok( isset($option['name']) ); + ok( isset($option['prompt']) ); + ok( isset($option['default']) ); + } + + } + public function testForCompatibility() { $parser = new PEARX\PackageXml\Parser; diff --git a/tests/data/package_xml/apcu/package.xml b/tests/data/package_xml/apcu/package.xml new file mode 100644 index 0000000..5bf7641 --- /dev/null +++ b/tests/data/package_xml/apcu/package.xml @@ -0,0 +1,186 @@ + + + apcu + pecl.php.net + APCu - APC User Cache + APC User Caching + + Joe Watkins + krakjoe + krakjoe@php.net + yes + + + Anatol Belski + ab + ab@php.net + yes + + 2013-04-28 + + + 4.0.2 + 4.0.2 + + + beta + beta + + PHP License + + - Fixed bug #15 APC compatibility option broken. (Anatol) + - Fixed bug #20 APCu's APCIterator constructor is not compatable with APC. (Anatol) + - Fixed resource leak when data preload fails. (Anatol) + - Fixed issue #29 php_apcu.dll does not load anymore under X64. (Anatol) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.3.0 + + + 1.4.0b1 + + + + apcu + + + + + + + + 2013-04-28 + + + 4.0.1 + 4.0.1 + + + beta + beta + + PHP License + + - Fix crash in cli on apc_store where enable_cli=0 + - Testing eval serializers + - Change apc_* to apcu_* in apc.php + - Fix exports in API + - Expose to userland whether APCu is compiled with the APC compatibility. + See the APCU_APC_FULL_BC constant. (Anatol) + - Fixed bin dump producing garbage data in multithreaded env. (Anatol) + + + 2013-03-27 + + + 4.0.0 + 4.0.0 + + + beta + beta + + PHP License + + All opcode caching abilities removed + The default locking is now rwlocks + APCu API installed in build environment + Please see TECHNOTES/README.md + + + +