|
1
|
|
|
<?php |
|
2
|
|
|
class MemcacheTest extends \PHPUnit\Framework\TestCase |
|
3
|
|
|
{ |
|
4
|
|
|
public function testConstruct() |
|
5
|
|
|
{ |
|
6
|
|
|
$cacheFile = new \Suricate\Cache\Memcache(); |
|
7
|
|
|
$this->assertEquals('localhost', $cacheFile->host); |
|
8
|
|
|
} |
|
9
|
|
|
|
|
10
|
|
|
public function testGetSetPort() |
|
11
|
|
|
{ |
|
12
|
|
|
$cacheFile = new \Suricate\Cache\Memcache(); |
|
13
|
|
|
|
|
14
|
|
|
$this->assertEquals(11211, $cacheFile->getPort()); |
|
15
|
|
|
$cacheFile->setPort(11221); |
|
16
|
|
|
$this->assertEquals(11221, $cacheFile->getPort()); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function testGetSetHost() |
|
20
|
|
|
{ |
|
21
|
|
|
$cacheFile = new \Suricate\Cache\Memcache(); |
|
22
|
|
|
|
|
23
|
|
|
$this->assertEquals('localhost', $cacheFile->getHost()); |
|
24
|
|
|
$cacheFile->setHost('127.0.0.1'); |
|
25
|
|
|
$this->assertEquals('127.0.0.1', $cacheFile->getHost()); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testGetSetExpiry() |
|
29
|
|
|
{ |
|
30
|
|
|
$cacheFile = new \Suricate\Cache\Memcache(); |
|
31
|
|
|
|
|
32
|
|
|
$this->assertEquals(3600, $cacheFile->getDefaultExpiry()); |
|
33
|
|
|
$cacheFile->setDefaultExpiry(60); |
|
34
|
|
|
$this->assertEquals(60, $cacheFile->getDefaultExpiry()); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function testGetSetCompression() |
|
38
|
|
|
{ |
|
39
|
|
|
$cacheFile = new \Suricate\Cache\Memcache(); |
|
40
|
|
|
|
|
41
|
|
|
$this->assertFalse($cacheFile->getUseCompression()); |
|
42
|
|
|
$this->assertFalse($cacheFile->useCompression); |
|
43
|
|
|
$cacheFile->setUseCompression(true); |
|
44
|
|
|
$this->assertTrue($cacheFile->getUseCompression()); |
|
45
|
|
|
$this->assertTrue($cacheFile->useCompression); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|