Inheritance: extends WP_UnitTestCase
Example #1
0
 /**
  * Run when initializing
  *
  * @return null
  */
 public static function setUpBeforeClass()
 {
     $file = realpath(dirname(__FILE__) . "/../database/test.sqlite3");
     self::$con = new PDO("sqlite:{$file}");
     // self::$con  = new PDO('mysql:host=localhost;dbname=torm',"torm","torm");
     TORM\Connection::setConnection(self::$con, "test");
     TORM\Connection::setEncoding("UTF-8");
     TORM\Connection::setDriver("sqlite");
     TORM\Factory::setFactoriesPath("./factories");
     TORM\Log::enable(false);
     TORM\Cache::getInstance()->setTimeout(300);
 }
Example #2
0
 public static function setUpBeforeClass()
 {
     global $FLOH_CONFIG;
     self::$testMemoryCache = true;
     // CONF('LH_CACHE_ENABLE') && CONF('LH_CACHE_MEMCACHE');
     self::$enabled = true;
     // CONF('LH_CACHE_ENABLE');
     $FLOH_CONFIG['LH_CACHE_DEBUG_ONPAGE'] = false;
     if (!self::$enabled) {
         self::markTestSkipped('CacheAbstract disabled');
     } else {
         CacheMemcached::singleton([['localhost', 11211]]);
         // set server
         CacheAbstract::clearAll();
     }
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     $GLOBALS['redis_server'] = array('host' => '127.0.0.1', 'port' => 6379);
     // create two cache objects with a shared cache dir
     // this simulates a typical cache situation, two separate requests interacting
     $this->cache =& $this->init_cache();
     $this->cache->cache_hits = $this->cache->cache_misses = 0;
     $this->cache->redis_calls = array();
     self::$exists_key = WP_Object_Cache::USE_GROUPS ? 'hExists' : 'exists';
     self::$get_key = WP_Object_Cache::USE_GROUPS ? 'hGet' : 'get';
     self::$set_key = WP_Object_Cache::USE_GROUPS ? 'hSet' : 'set';
     self::$incrBy_key = WP_Object_Cache::USE_GROUPS ? 'hIncrBy' : 'incrBy';
     // 'hIncrBy' isn't a typo here — Redis doesn't support decrBy on groups
     self::$decrBy_key = WP_Object_Cache::USE_GROUPS ? 'hIncrBy' : 'decrBy';
     self::$delete_key = WP_Object_Cache::USE_GROUPS ? 'hDel' : 'del';
     self::$flush_all_key = 'flushAll';
 }
Example #4
0
 public function setUp()
 {
     parent::setUp();
     Cache::clear();
     CacheTest::$call_count = 0;
 }
Example #5
0
 public static function setUpBeforeClass()
 {
     self::$root = vfsStream::setup('test/cache');
 }
 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     self::$cacheDirectoryPath = self::$rootCacheDirectory . 'DirectoryCache';
 }