You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-commits@incubator.apache.org by je...@apache.org on 2011/05/15 05:42:28 UTC

[zeta-commits] svn commit: r1103273 - in /incubator/zetacomponents/trunk/Configuration: src/configuration_manager.php tests/configuration_manager_test.php

Author: jeromer
Date: Sun May 15 05:42:28 2011
New Revision: 1103273

URL: http://svn.apache.org/viewvc?rev=1103273&view=rev
Log:
- Fixed #ZETACOMP-83: Add ezcConfigurationManager::getGroupNames()

# Based on a patch provided by Damien Pobel. Thanks !

Modified:
    incubator/zetacomponents/trunk/Configuration/src/configuration_manager.php
    incubator/zetacomponents/trunk/Configuration/tests/configuration_manager_test.php

Modified: incubator/zetacomponents/trunk/Configuration/src/configuration_manager.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Configuration/src/configuration_manager.php?rev=1103273&r1=1103272&r2=1103273&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Configuration/src/configuration_manager.php (original)
+++ incubator/zetacomponents/trunk/Configuration/src/configuration_manager.php Sun May 15 05:42:28 2011
@@ -557,5 +557,22 @@ class ezcConfigurationManager
         $reader = $this->fetchReader( $name );
         return $reader->configExists();
     }
+
+    /**
+     * Returns the names of all the groups as an array
+     *
+     * @throws ezcConfigurationUnknownConfigException if the configuration
+     *         $name does not exist.
+     * @throws ezcConfigurationManagerNotInitializedException
+     *         if the manager has not been initialized with the init() method.
+     *
+     * @param string $name
+     * @return array
+     */
+    public function getGroupNames( $name )
+    {
+        $config = $this->fetchConfig( $name );
+        return $config->getGroupNames();
+    }
 }
 ?>

Modified: incubator/zetacomponents/trunk/Configuration/tests/configuration_manager_test.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Configuration/tests/configuration_manager_test.php?rev=1103273&r1=1103272&r2=1103273&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Configuration/tests/configuration_manager_test.php (original)
+++ incubator/zetacomponents/trunk/Configuration/tests/configuration_manager_test.php Sun May 15 05:42:28 2011
@@ -423,10 +423,23 @@ class ezcConfigurationManagerTest extend
         $this->assertEquals( "l'été", $setting );
     }
 
+    // test for bug #ZETACOMP-83
+    public function testGetGroupNames()
+    {
+        $config = ezcConfigurationManager::getInstance();
+        $config->init( 'ezcConfigurationIniReader', 'Configuration/tests/files' );
+
+        $expectedGroups = array( 'NotTheOnlyGroup', 'TheSecond' );
+
+        $this->assertEquals(
+            $expectedGroups, $config->getGroupNames( 'two-groups' )
+        );
+    }
+
     public static function suite()
     {
          return new PHPUnit_Framework_TestSuite( 'ezcConfigurationManagerTest' );
     }
 }
 
-?>
+?>
\ No newline at end of file