blob: eded351f4f5e83d8668259936421c044b1f26b5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
require_once(dirname(__FILE__).'/../common.php');
require_once(dirname(__FILE__).'/CacheTestCase.php');
Prado::using('System.Caching.TSqliteCache');
class utSqliteCache extends CacheTestCase
{
private $dbFile;
public function __construct()
{
parent::__construct();
if(Prado::getPathOfAlias('utSqliteCache')===null)
Prado::setPathOfAlias('utSqliteCache',dirname(__FILE__));
$this->dbFile='utSqliteCache.test';
}
public function tearDown()
{
$file=Prado::getPathOfNamespace('utSqliteCache.test',TSqliteCache::DB_FILE_EXT);
if(is_file($file))
unlink($file);
else
$this->fail("Unable to clean up db file: '".$file."'.");
}
public function testInit()
{
$cache=new TSqliteCache;
$this->assertTrue($cache->getDbFile()===null);
$cache->setDbFile($this->dbFile);
$this->assertTrue($cache->getDbFile()===$this->dbFile);
$cache->init(null,null);
try
{
$cache->setDbFile('newfile.db');
$this->fail('exception not raised when setting DbFile after init');
}
catch(TInvalidOperationException $e)
{
$this->pass();
}
}
public function testBasicOperations()
{
$cache=new TSqliteCache;
$cache->setDbFile($this->dbFile);
$cache->init(null,null);
$this->setCache($cache);
$this->basicOperations();
$this->setCache(null);
}
}
?>
|