Browse Source

Zend_Cache: ZF-9738 unit tests.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21975 44c647ce-9c0f-0410-b52a-842ac1e357ba
alexander 15 năm trước cách đây
mục cha
commit
5806925e7b
1 tập tin đã thay đổi với 30 bổ sung2 xóa
  1. 30 2
      tests/Zend/Application/Resource/CacheManagerTest.php

+ 30 - 2
tests/Zend/Application/Resource/CacheManagerTest.php

@@ -129,7 +129,7 @@ class Zend_Application_Resource_CacheManagerTest extends PHPUnit_Framework_TestC
         $this->assertEquals('/foo', $cacheTemplate['backend']['options']['cache_dir']);
 
     }
-    
+
     public function testShouldCreateNewCacheTemplateIfConfigNotMatchesADefaultTemplate()
     {
         $options = array(
@@ -146,7 +146,7 @@ class Zend_Application_Resource_CacheManagerTest extends PHPUnit_Framework_TestC
         $cacheTemplate = $manager->getCacheTemplate('foo');
         $this->assertSame($options['foo'], $cacheTemplate);
     }
-    
+
     public function testShouldNotMeddleWithFrontendOrBackendCapitalisation()
     {
         $options = array(
@@ -182,6 +182,34 @@ class Zend_Application_Resource_CacheManagerTest extends PHPUnit_Framework_TestC
         $cache = $manager->getCache('foo');
         $this->assertTrue($cache instanceof Zend_Cache_Core);
     }
+
+    /**
+     * @group ZF-9738
+     */
+    public function testZendServer()
+    {
+        if (!function_exists('zend_disk_cache_store')) {
+            $this->markTestSkipped('ZendServer is required for this test');
+        }
+
+        $options = array(
+            'foo' => array(
+                'frontend' => array(
+                    'name' => 'Core',
+                    'options' => array(
+                        'lifetime' => 7200,
+                    ),
+                ),
+                'backend' => array(
+                    'name' => 'ZendServer_Disk',
+                ),
+            ),
+        );
+        $resource = new Zend_Application_Resource_Cachemanager($options);
+        $manager = $resource->init();
+        $cache = $manager->getCache('foo')->getBackend();
+        $this->assertTrue($cache instanceof Zend_Cache_Backend_ZendServer_Disk);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_CacheManagerTest::main') {