[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/cache/tests/cases/ -> lmbCacheFilePersisterTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/core/src/lmbObject.class.php');
  10  lmb_require('limb/cache/src/lmbCacheFilePersister.class.php');
  11  lmb_require('limb/fs/src/lmbFs.class.php');
  12  lmb_require(dirname(__FILE__) . '/lmbCacheTestBase.class.php');
  13  
  14  class lmbCacheFilePersisterTest extends lmbCacheTestBase
  15  {
  16    var $cache_dir;
  17  
  18    function _createPersisterImp()
  19    {
  20      $this->cache_dir = LIMB_VAR_DIR . '/cache/whatever';
  21      return new lmbCacheFilePersister($this->cache_dir);
  22    }
  23  
  24    function testCachedDiskFiles()
  25    {
  26      $items = lmbFs :: ls($this->cache_dir);
  27      $this->assertEqual(sizeof($items), 0);
  28  
  29      $this->cache->put(1, $cache_value = 'value');
  30  
  31      $items = lmbFs :: ls($this->cache_dir);
  32      $this->assertEqual(sizeof($items), 1);
  33  
  34      $this->assertEqual($this->cache->get(1), $cache_value);
  35  
  36      $this->cache->flushAll();
  37      rmdir($this->cache_dir);
  38    }
  39  
  40    function testProperSerializing()
  41    {
  42      $obj = new lmbObject();
  43      $obj->set('foo', 'wow');
  44  
  45      $this->cache->put(1, $obj);
  46  
  47      $this->assertEqual($obj, $this->cache->get(1));
  48    }
  49  }
  50  
  51  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7