Sfoglia il codice sorgente

ZF-11425
Zend_Application
Add support for YAML files with .yml extension


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24100 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan 14 anni fa
parent
commit
c811448e89

+ 1 - 0
library/Zend/Application.php

@@ -395,6 +395,7 @@ class Zend_Application
                 break;
 
             case 'yaml':
+            case 'yml':
                 $config = new Zend_Config_Yaml($file, $environment);
                 break;
 

+ 9 - 0
tests/Zend/Application/ApplicationTest.php

@@ -320,6 +320,15 @@ class Zend_Application_ApplicationTest extends PHPUnit_Framework_TestCase
         $application = new Zend_Application('testing', dirname(__FILE__) . '/_files/appconfig.json');
         $this->assertTrue($application->hasOption('foo'));
     }
+    
+    /**
+     * @group ZF-11425
+     */
+    public function testPassingStringYmlConfigPathOptionToConstructorShouldLoadOptionsAsYaml()
+    {
+        $application = new Zend_Application('testing', dirname(__FILE__) . '/_files/appconfig.yml');
+        $this->assertTrue($application->hasOption('foo'));
+    }
 
     public function testPassingArrayOptionsWithConfigKeyShouldLoadOptions()
     {

+ 7 - 0
tests/Zend/Application/_files/appconfig.yml

@@ -0,0 +1,7 @@
+production:
+  foo: "bar"
+
+testing:
+  _extends: production
+  
+