incubator-zeta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jero...@apache.org
Subject [zeta-commits] svn commit: r1103273 - in /incubator/zetacomponents/trunk/Configuration: src/configuration_manager.php tests/configuration_manager_test.php
Date Sun, 15 May 2011 05:42:28 GMT
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



Mime
View raw message