diff options
author | alban <> | 2006-01-31 10:01:33 +0000 |
---|---|---|
committer | alban <> | 2006-01-31 10:01:33 +0000 |
commit | 282210962cebc9833030879c81ad26e0e22913aa (patch) | |
tree | 5388d9a52c175f859af79b62c405dd923febce85 | |
parent | 328d05bb0cd1d9263ecd4fe1902c4f235f166776 (diff) |
TAPCCache unit test.
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | tests/UnitTests/framework/Data/utAPCCache.php | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index edd92b4a..f762b57a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -814,6 +814,7 @@ tests/UnitTests/framework/Collections/utList.php -text tests/UnitTests/framework/Collections/utMap.php -text tests/UnitTests/framework/Data/CacheTestCase.php -text tests/UnitTests/framework/Data/test.db -text +tests/UnitTests/framework/Data/utAPCCache.php -text tests/UnitTests/framework/Data/utDateTimeSimpleFormatter.php -text tests/UnitTests/framework/Data/utMemCache.php -text tests/UnitTests/framework/Data/utSqliteCache.php -text diff --git a/tests/UnitTests/framework/Data/utAPCCache.php b/tests/UnitTests/framework/Data/utAPCCache.php new file mode 100644 index 00000000..b9e0f3e8 --- /dev/null +++ b/tests/UnitTests/framework/Data/utAPCCache.php @@ -0,0 +1,45 @@ +<?php
+
+require_once(dirname(__FILE__).'/../common.php');
+require_once(dirname(__FILE__).'/CacheTestCase.php');
+Prado::using('System.Data.TAPCCache');
+
+class utAPCCache extends CacheTestCase
+{
+
+ public function testInit()
+ {
+ if(!extension_loaded('apc'))
+ {
+ $this->fail('TAPCCache is not tested. PHP extension "apc" is required by TAPCCache.');
+ return;
+ }
+ //compatibility test as this time of writing 01/02/2006 (dd//mm//yyyy)
+ $apc_default_ini = $apc_default=ini_get('apc.cache_by_default');
+ if ($apc_default=='Off' || $apc_default='off')
+ $apc_default=0;
+ elseif($apc_default=='On' || $apc_default='on')
+ $apc_default=1;
+ $apc_default=(boolean)$apc_default;
+ if($apc_default) {
+ $this->fail('You have to disable apc.cache_by_default in your php.ini : you have apc.cache_by_default='.$apc_default_ini.' but currently prado won\'t execute without errors with APC caching all prado php files.');
+ return;
+ }
+ }
+
+ public function testBasicOperations()
+ {
+ if(!extension_loaded('apc'))
+ {
+ $this->fail('TAPCCache is not tested. PHP extension "apc" is required by TAPCCache.');
+ return;
+ }
+ $cache=new TAPCCache;
+ $cache->init(null);
+ $this->setCache($cache);
+ $this->basicOperations();
+ $this->setCache(null);
+ }
+}
+
+?>
\ No newline at end of file |