コード例 #1
0
ファイル: complex_stack_test.php プロジェクト: bmdevel/ezc
 protected function setup()
 {
     if (!self::$stackInitialized) {
         if (ezcBaseFeatures::hasExtensionSupport('apc')) {
             $memoryStorage = new ezcCacheStorageApcPlain();
         } else {
             if (ezcBaseFeatures::hasExtensionSupport('memcache')) {
                 $memoryStorage = new ezcCacheStorageMemcachePlain('foo');
             } else {
                 $this->markTestSkipped('APC or Memcached needed to run this test.');
             }
         }
         // Start cleanly
         $memoryStorage->reset();
         $tmpDir = $this->createTempDir(__CLASS__);
         $tmpDirEvalArray = "{$tmpDir}/plain";
         $tmpDirArray = "{$tmpDir}/array";
         mkdir($tmpDirEvalArray);
         mkdir($tmpDirArray);
         $fileStorageEvalArray = new ezcCacheStorageFileEvalArray($tmpDirEvalArray);
         $fileStorageArray = new ezcCacheStorageFileArray($tmpDirArray);
         ezcCacheStackTestConfigurator::reset();
         ezcCacheStackTestConfigurator::$storages = array(new ezcCacheStackStorageConfiguration('eval_array_storage', $fileStorageEvalArray, 10, 0.8), new ezcCacheStackStorageConfiguration('array_storage', $fileStorageArray, 8, 0.5), new ezcCacheStackStorageConfiguration('memory_storage', $memoryStorage, 5, 0.5));
         ezcCacheStackTestConfigurator::$metaStorage = $fileStorageArray;
         ezcCacheManager::createCache(__CLASS__, null, 'ezcCacheStack', new ezcCacheStackOptions(array('configurator' => 'ezcCacheStackTestConfigurator', 'replacementStrategy' => 'ezcCacheStackLfuReplacementStrategy')));
         self::$stackInitialized = true;
     }
     $this->testDataArray = array(array('id_1', 'id_1_content', array('lang' => 'en', 'area' => 'news')), array('id_2', 'id_2_content', array('lang' => 'en', 'area' => 'news')), array('id_3', 'id_3_content', array('lang' => 'de', 'area' => 'news')), array('id_4', 'id_4_content', array('lang' => 'no', 'area' => 'news')), array('id_5', 'id_5_content', array('lang' => 'de', 'area' => 'news')));
 }
コード例 #2
0
ファイル: suite.php プロジェクト: bmdevel/ezc
 public function __construct()
 {
     parent::__construct();
     $this->setName("Cache");
     $this->addTest(ezcCacheStackTest::suite());
     $this->addTest(ezcCacheComplexCacheTest::suite());
     $this->addTest(ezcCacheStorageFileOptionsTest::suite());
     $this->addTest(ezcCacheStorageOptionsTest::suite());
     $this->addTest(ezcCacheStorageFileTest::suite());
     $this->addTest(ezcCacheStorageFileArrayTest::suite());
     $this->addTest(ezcCacheStorageFileObjectTest::suite());
     $this->addTest(ezcCacheStorageFileEvalArrayTest::suite());
     $this->addTest(ezcCacheStorageFilePlainTest::suite());
     $this->addTest(ezcCacheStorageApcPlainTest::suite());
     $this->addTest(ezcCacheStorageFileApcArrayTest::suite());
     $this->addTest(ezcCacheMemcacheBackendTest::suite());
     $this->addTest(ezcCacheStorageMemcachePlainTest::suite());
     $this->addTest(ezcCacheManagerTest::suite());
     $this->addTest(ezcCacheStackOptionsTest::suite());
     $this->addTest(ezcCacheStackStorageConfigurationTest::suite());
     $this->addTest(ezcCacheStackLruMetaDataTest::suite());
     $this->addTest(ezcCacheStackLfuMetaDataTest::suite());
     $this->addTest(ezcCacheStackLruReplacementStrategyTest::suite());
     $this->addTest(ezcCacheStackLfuReplacementStrategyTest::suite());
 }