Author: as
Date: Wed Nov 28 10:47:41 2007
New Revision: 6858

Log:
- Fixed a broken test.

Modified:
    trunk/Cache/tests/manager_test.php

Modified: trunk/Cache/tests/manager_test.php
==============================================================================
--- trunk/Cache/tests/manager_test.php [iso-8859-1] (original)
+++ trunk/Cache/tests/manager_test.php [iso-8859-1] Wed Nov 28 10:47:41 2007
@@ -25,13 +25,7 @@
      * @var array
      * @access protected
      */
-    protected $data = array(
-        'ezcCacheStorageFilePlain',
-        'ezcCacheStorageFileArray',
-        'ezcCacheStorageFileEvalArray',
-        'ezcCacheStorageApcPlain',
-        'ezcCacheStorageFileApcArray'
-    );
+    protected $data = array();
     
     /**
      * Temp location for caches.
@@ -51,20 +45,39 @@
         return new PHPUnit_Framework_TestSuite( "ezcCacheManagerTest" );
     }
 
+    public function __construct()
+    {
+        $this->data = array(
+                        'ezcCacheStorageFilePlain',
+                        'ezcCacheStorageFileArray',
+                        'ezcCacheStorageFileEvalArray',
+                        'ezcCacheStorageApcPlain',
+                        'ezcCacheStorageFileApcArray'
+                        );
+    }
+
     public function testManagerCreateCache_Success()
     {
         foreach ( $this->data as $id => $class ) 
         {
             $location = $this->createTempDir($class);
             ezcCacheManager::createCache( $id, $location, $class );
-            $realCache = ezcCacheManager::getCache( $id );
-            $fakeCache = new $class( realpath( $location ) );
-            $this->assertEquals( 
-                $realCache,
-                $fakeCache, 
-                'Invalid object created from ezcCacheManager. Expected "' . 
get_class( $realCache )  . '", found "'. get_class( $fakeCache ) .'".'  
-            );
-            unset( $realCache ); unset( $fakeCache );
+
+            try
+            {
+                $realCache = ezcCacheManager::getCache( $id );
+                $fakeCache = new $class( realpath( $location ) );
+                $this->assertEquals( 
+                    $realCache,
+                    $fakeCache, 
+                    'Invalid object created from ezcCacheManager. Expected "' 
. get_class( $realCache )  . '", found "'. get_class( $fakeCache ) .'".'  
+                );
+                unset( $realCache ); unset( $fakeCache );
+            }
+            catch ( ezcBaseExtensionNotFoundException $e )
+            {
+            }
+
             $this->removeTempDir($location);
         }
         $this->assertTrue( true );


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to