Просмотр исходного кода

Added tests checking for cache backend naming capitalisation corruption (none found but added anyway for ZFINC-125)

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20524 44c647ce-9c0f-0410-b52a-842ac1e357ba
padraic 16 лет назад
Родитель
Сommit
5ea923b040

+ 16 - 0
tests/Zend/Application/Resource/CacheManagerTest.php

@@ -129,6 +129,7 @@ class Zend_Application_Resource_CacheManagerTest extends PHPUnit_Framework_TestC
         $this->assertEquals('/foo', $cacheTemplate['backend']['options']['cache_dir']);
 
     }
+    
     public function testShouldCreateNewCacheTemplateIfConfigNotMatchesADefaultTemplate()
     {
         $options = array(
@@ -145,6 +146,21 @@ class Zend_Application_Resource_CacheManagerTest extends PHPUnit_Framework_TestC
         $cacheTemplate = $manager->getCacheTemplate('foo');
         $this->assertSame($options['foo'], $cacheTemplate);
     }
+    
+    public function testShouldNotMeddleWithFrontendOrBackendCapitalisation()
+    {
+        $options = array(
+            'foo' => array(
+                'backend' => array(
+                    'name' => 'BlackHole'
+                )
+            )
+        );
+        $resource = new Zend_Application_Resource_Cachemanager($options);
+        $manager = $resource->init();
+        $cacheTemplate = $manager->getCacheTemplate('foo');
+        $this->assertEquals('BlackHole', $cacheTemplate['backend']['name']);
+    }
 
 }
 

+ 18 - 0
tests/Zend/Cache/ManagerTest.php

@@ -167,6 +167,24 @@ class Zend_Cache_ManagerTest extends PHPUnit_Framework_TestCase
         $manager->setCacheTemplate('myCache', $config);
         $this->assertSame($config, $manager->getCacheTemplate('myCache'));
     }
+    
+    public function testSetsConfigTemplateWithoutMultipartNameNormalisation()
+    {
+        $manager = new Zend_Cache_Manager;
+        $config = array(
+            'frontend' => array(
+                'name' => 'Core',
+                'options' => array(
+                    'automatic_serialization' => true
+                )
+            ),
+            'backend' => array(
+                'name' => 'BlackHole'
+            )
+        );
+        $manager->setCacheTemplate('myCache', $config);
+        $this->assertSame($config, $manager->getCacheTemplate('myCache'));
+    }
 
     public function testSetsOptionsTemplateUsingZendConfig()
     {