blob: 865f427dfab43a7506d6ac150b91cd2ba7f61b61 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<?php
/**
* Smarty PHPunit tests for cache resource memcache
*
* @author Uwe Tews
*/
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/**
* class for cache resource memcache tests
*
*
*
*
*/
class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
{
/**
* Sets up the fixture
* This method is called before a test is executed.
*
*/
public function setUp(): void
{
if (!class_exists('Memcache')) {
$this->markTestSkipped('Memcache not available');
}
$this->setUpSmarty(__DIR__);
parent::setUp();
$this->smarty->setCachingType('memcachetest');
}
public function testInit()
{
$this->cleanDirs();
}
protected function doClearCacheAssertion($a, $b)
{
$this->assertEquals(- 1, $b);
}
public function testGetCachedFilepathSubDirs()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl');
$sha1 = $tpl->getSource()->uid . '#helloworld_tpl##';
$this->assertEquals($sha1, $tpl->getCached()->filepath);
}
/**
* test getCachedFilepath with cache_id
*/
public function testGetCachedFilepathCacheId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar');
$sha1 = $tpl->getSource()->uid . '#helloworld_tpl#foo|bar#';
$this->assertEquals($sha1, $tpl->getCached()->filepath);
}
/**
* test getCachedFilepath with compile_id
*/
public function testGetCachedFilepathCompileId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', null, 'blar');
$sha1 = $tpl->getSource()->uid . '#helloworld_tpl##blar';
$this->assertEquals($sha1, $tpl->getCached()->filepath);
}
/**
* test getCachedFilepath with cache_id and compile_id
*/
public function testGetCachedFilepathCacheIdCompileId()
{
$this->smarty->caching = true;
$this->smarty->cache_lifetime = 1000;
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar', 'blar');
$sha1 = $tpl->getSource()->uid . '#helloworld_tpl#foo|bar#blar';
$this->assertEquals($sha1, $tpl->getCached()->filepath);
}
}
|