svn: /pear/pear-core/trunk/ PEAR/Command/Config.php package-PEAR.xml package2.xml tests/PEAR_Command_Config/config-get/bug18581.phpt

From: Date: Tue, 07 Jun 2011 03:00:43 +0000
Subject: svn: /pear/pear-core/trunk/ PEAR/Command/Config.php package-PEAR.xml package2.xml tests/PEAR_Command_Config/config-get/bug18581.phpt
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9923@lists.php.net to get a copy of this message
dufuz Tue, 07 Jun 2011 03:00:43 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=311878 Log: Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] # Added a test for the bug Bug: http://pear.php.net/bugs/18581 (unknown) Changed paths: U pear/pear-core/trunk/PEAR/Command/Config.php U pear/pear-core/trunk/package-PEAR.xml U pear/pear-core/trunk/package2.xml A pear/pear-core/trunk/tests/PEAR_Command_Config/config-get/bug18581.phpt Modified: pear/pear-core/trunk/PEAR/Command/Config.php =================================================================== --- pear/pear-core/trunk/PEAR/Command/Config.php 2011-06-07 02:35:36 UTC (rev 311877) +++ pear/pear-core/trunk/PEAR/Command/Config.php 2011-06-07 03:00:43 UTC (rev 311878) @@ -205,12 +205,13 @@ return $this->raiseError("config-get expects 1 or 2 parameters"); } + $reg = &$this->config->getRegistry(); $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); - $reg = &$this->config->getRegistry(); if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } + $channel = $reg->channelName($channel); $this->ui->outputData($this->config->get($config_key, $layer, $channel), $command); return true; } Modified: pear/pear-core/trunk/package-PEAR.xml =================================================================== --- pear/pear-core/trunk/package-PEAR.xml 2011-06-07 02:35:36 UTC (rev 311877) +++ pear/pear-core/trunk/package-PEAR.xml 2011-06-07 03:00:43 UTC (rev 311878) @@ -100,6 +100,9 @@ pecl install --with-option=dir memcached This allows for customized setups while still having the benefit of using the pear installer. (pear will not remember the configure params for the next upgrade) + + Bug Fixes: + * Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] </notes> <provides type="class" name="OS_Guess"/> <provides type="class" name="System"/> Modified: pear/pear-core/trunk/package2.xml =================================================================== --- pear/pear-core/trunk/package2.xml 2011-06-07 02:35:36 UTC (rev 311877) +++ pear/pear-core/trunk/package2.xml 2011-06-07 03:00:43 UTC (rev 311878) @@ -104,6 +104,9 @@ pecl install --with-option=dir memcached This allows for customized setups while still having the benefit of using the pear installer. (pear will not remember the configure params for the next upgrade) + + Bug Fixes: + * Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] </notes> <contents> <dir name="/"> Added: pear/pear-core/trunk/tests/PEAR_Command_Config/config-get/bug18581.phpt =================================================================== --- pear/pear-core/trunk/tests/PEAR_Command_Config/config-get/bug18581.phpt (rev 0) +++ pear/pear-core/trunk/tests/PEAR_Command_Config/config-get/bug18581.phpt 2011-06-07 03:00:43 UTC (rev 311878) @@ -0,0 +1,61 @@ +--TEST-- +config-get command: bug #18581, "config-get -c" not returning channel's configuration when using alias +--SKIPIF-- +<?php +if (!getenv('PHP_PEAR_RUNTESTS')) { + echo 'skip'; +} +?> +--FILE-- +<?php +error_reporting(1803); +require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc'; + +$chf = &new PEAR_ChannelFile; + +$chf->fromXmlString($first = '<?xml version="1.0" encoding="UTF-8" ?> +<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd"> + <name>pear.horde.org</name> + <summary>Horde PEAR server</summary> + <suggestedalias>horde</suggestedalias> + <servers> + <primary> + <rest> + <baseurl type="REST1.0">http://pear.horde.org/rest/</baseurl> + <baseurl type="REST1.1">http://pear.horde.org/rest/</baseurl> + <baseurl type="REST1.2">http://pear.horde.org/rest/</baseurl> + <baseurl type="REST1.3">http://pear.horde.org/rest/</baseurl> + </rest> + </primary> + </servers> +</channel>'); +$phpunit->assertTrue($chf->validate(), 'initial parse'); +$phpunit->assertNoErrors('after'); + +$registry = $config->getRegistry(); +$registry->addChannel($chf); +$phpunit->assertNoErrors('Add channel to registry'); + +$e = $command->run('config-set', array('channel' => 'pear.horde.org'), array('www_dir', $temp_path . DIRECTORY_SEPARATOR . 'test')); +$phpunit->assertNoErrors('after'); +$fakelog->getLog(); // Flush log + +$e = $command->run('config-get', array('channel' => 'pear.horde.org'), array('www_dir')); +$phpunit->assertNoErrors('after'); +$phpunit->assertEquals(array( + 0 => + array ( + 'info' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'cmd' => 'config-get', + ), +), $fakelog->getLog(), 'Full length channel name config-get'); + +$e = $command->run('config-get', array('channel' => 'horde'), array('www_dir')); +$phpunit->assertNoErrors('after'); +$phpunit->assertEquals(array( + 0 => + array ( + 'info' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'cmd' => 'config-get', + ), +), $fakelog->getLog(), 'Alias channel name config-get'); \ No newline at end of file

« previous php.pear.core (#9923) next »